#json (java script object notation) is a standardized format commonly used to transfer data as text #from web application to server and vice versa. #json is a built in module in python import json #loads method used to convert json format to python jsonstr= '{"name":"harish","goal":"engineer","channel":"softwareharish"}' #json string parse=json.loads(jsonstr) #convert json string to python print (parse[ "goal" ]) print (parse) #dumps method used to convert python to json format dic1={ "name" : "harish" , "goal" : "engineer" , "channel" : "softwareharish" , "subscribers" : 1000 , "watchtime" : 2000 , "israj" : False } x=json.dumps(dic1) #convert python to json string print ( "json string \n " , x)
Comments
Post a Comment