python - How to access decoded JSON values in .txt file -
i sending json request server , need access time-stamp dynamically changes based on time variable. using requests send post request json .txt file.
my json here. able access dateandtime field can use current time send query. json consumed server data2 =jsonpickle.encode(jsonpickle.decode(f2.read()) )
f2
json file.
here post request have changed;
dateandtime
parameter in r2 = requests.post(url2, data=data2, headers=headers2,timeout=(connect_timeout, 10))
{ "requestspecificdetail": { "parentsrnumberforlink": "" }, "metadata": { "appversion": "1.34", "devicemodel": "x86_64", "dateandtime": "01/15/2015 12:46:36", "devicetoken": "a2c1dd9d-d17d-4031-ba3e-977c250bfd58", "osversion": "8.1" }, "srdata": { "srnumber": "1-3580171" } }
data2 = jsonpickle.decode(whatever) data2["metadata"]["dateandtime"] = "whatever" data2 = jsonpickle.encode(data2)
Comments
Post a Comment