Python JSON Convert JSON to string














































Python JSON Convert JSON to string



Convert JSON to string

Data in transmitted accross platforms using API calls. Data is mostly retrived in JSON format. We can convert the obtained JSON data into String data for the ease of storing and working with it.

Let%u2019s see how to convert JSON to String.

json to String on dummy data using %u201Cjson.dumps%u201D


import json 

# create a sample json 

a = {"name" : "cppsecrets", "Topic" : "Json to String"} 

# Convert JSON to String 

y = json.dumps(a) 

print(y) 
print(type(y)) 


output: 

{"name": "cppsecrets", "Topic": "Json to String"}
<class 'str'>





Comments