Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python print pretty json


import json

json_data = '[{"ID":10,"Name":"Pankaj","Role":"CEO"},' 
            '{"ID":20,"Name":"David Lee","Role":"Editor"}]'

json_object = json.loads(json_data)

json_formatted_str = json.dumps(json_object, indent=2)

print(json_formatted_str)
Comment

response.json results in pretty data python

import requests
import json
r = requests.get('http://server.com/api/2/....')
pretty_json = json.loads(r.text)
print (json.dumps(pretty_json, indent=2))
Comment

pretty json python

print(json.dumps(dict, indent=4))
Comment

python json.dumps pretty print

json.dumps(x, indent=4)
Comment

PREVIOUS NEXT
Code Example
Python :: python find closest value in list 
Python :: how to detect an even number in python 
Python :: pandas read_csv nan as empty string 
Python :: selenium get back from iframe python 
Python :: python delete file with extension 
Python :: how to click on button using python 
Python :: how to separate a string or int with comma in python 
Python :: django rest framework default_authentication_classes 
Python :: calculate vif in python 
Python :: how to make rich presence discord,py 
Python :: list to dict python 
Python :: pyspark datetime add hours 
Python :: print a text in python 
Python :: pygame holding a button down 
Python :: python execute time 
Python :: beautifulsoup find_all by id 
Python :: invert a dictionary python 
Python :: python sqlite dict 
Python :: check if word contains a word in a list python 
Python :: weekday pandas 
Python :: python run system command 
Python :: how to create random tensor with tensorflow 
Python :: tkinter button foreground color click 
Python :: change python version ubuntu 
Python :: python os remove extension 
Python :: python download for ubuntu 20.04 
Python :: Efficiently count zero elements in numpy array? 
Python :: input array of string in python 
Python :: np.rand.randint 
Python :: datetime utcnow 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =