참조: http://docs.python-guide.org/en/latest/scenarios/json/


1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json
 
# json string to dict obj
json_string = '{"first_name": "Guido", "last_name":"Rossum"}'
parsed_json = json.loads(json_string)
print(parsed_json['first_name'])
 
# dict obj to json string
= {
    'first_name''Guido',
    'second_name''Rossum',
    'titles': ['BDFL''Developer'],
}
print(json.dumps(d))
cs




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/