I have json file like this:
{
"url": {
"188.40.0.138\n": {
"bytes": 13882,
"code": 403
},
"iantivirus.us\n": {
"bytes": 13563,
"code": 503
},
"ibmsupport.net\n": {
"bytes": 13648,
"code": 503
},
"usbnak.com\n": {
"bytes": 13779,
"code": 403
}
}
}
i want to convert this into a csv file with following format: url,188.40.0.138\n,13882.403
when i uses (say this is loaded to variable data)
for i in data['url']"
print i['status'] # says index should be integer
print i # prints 188.40.0.138\n
print i[0:3] #prints 188.
the problem here is i am unable to access inner elements
'url'static? Did you mean to writeurl,188.40.0.138\n,13882.403, thenurl,iantivirus.us\n, 13563, etc. or shouldurlbe omitted? Are there other keys indata?