user69726
0
Q:

list to json python

import json
friends_list = [
    'John','Rambo','Sam',
]
json_format = json.dumps(friends_list)
print(json_format)
print(type(json_format))
#PYTHON OUTPUT
["John", "Rambo", "Sam"]
<class 'str'>
2

  import json

# some JSON:
x =  '{ "name":"John", "age":30, "city":"New 
  York"}'

# parse x:
y = json.loads(x)
1

New to Communities?

Join the community