JSON Encode and Decode using Python

json library

import json

data = {
    'name': 'John',
    'scores': [95, 60, 75],
}

jsonStr = json.dumps(data)
print(jsonStr)

data = json.loads(jsonStr)
print(data)

Leave a Comment

Cancel reply

Your email address will not be published.