What is the method used to parse a string containing json data so that you can work with the data in python?
Answers
Answered by
6
Sometimes your json is not a string. For example if you are getting a json from a url like this: j = urllib2.urlopen('http://site.com/data .json'). you will need to use json.load, not ...
Answered by
1
Answer:
PERFECT ANSWER BELOW
(my_string is the string, jsondata is the parsed output as a dict)
↓↓
import json
my_string='{ "key":" value","key2": "value2" } '
jsondata=json.dumps(my_string)
Similar questions