kingjames23
kingjames23

Reputation: 95

how to convert a string in json format to normal string format in python

i'm receiving a string in json format. It is str format, like this:

'{"name":"Jason", "age":"10"}'

I want to transform it in a "normal" string, exactly like this:

Jason 10

Upvotes: 0

Views: 70

Answers (1)

AChampion
AChampion

Reputation: 30258

You can use the json module to do this:

import json

data = json.loads(json_str)
print(data['name'], data['age'])

Upvotes: 1

Related Questions