. Rising Code Challenges Skip to main content

Posts

Showing posts from May, 2018

How to print pretty json in python

Json is the data set which contain key and value pair. Example: json_string =  [ "foo" , { "bar" :[ "baz" , null, 1.0 , 2 ]}] print (json_string) output:  ["foo", {"bar":["baz", null, 1.0, 2]}] print (json.dumps(chain, indent = 4 , sort_keys = True )) output: [ "foo" , { "bar" : [ "baz" , null, 1.0 , 2 ] } ]