Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python – Convert JSON to string

  • Last Updated : 02 Jun, 2021

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

Let’s see how to convert JSON to String.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Method #1: Json to String on dummy data using “json.dumps”


import json
# create a sample json
a = {"name" : "GeeksforGeeks", "Topic" : "Json to String", "Method": 1}
# Convert JSON to String
y = json.dumps(a)


Method #2: Json to String using an API using requests and “json.dumps”


import json
import requests
# Get dummy data using an API
# Convert data to dict
data = json.loads(res.text)
# Convert dict to string
data = json.dumps(data)



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!