Re: Decoding JSON file using python

2015-05-28 Thread Denis McMahon
On Thu, 28 May 2015 13:32:39 +1000, Cameron Simpson wrote: On 28May2015 01:38, Jon Ribbens jon+use...@unequivocal.co.uk wrote: On 2015-05-27, Karthik Sharma karthik.sha...@gmail.com wrote: I tried modifying the program as follows as per your suggestion.Doesn't seem to work. That's because you

Re: Decoding JSON file using python

2015-05-28 Thread Denis McMahon
On Wed, 27 May 2015 15:23:31 -0700, Karthik Sharma wrote: The JSON structure is valid as shown by http://jsonlint.com/ Not when I paste it in it's not. The data attribute is an unterminated string and is not followed by a comma. -- Denis McMahon, denismfmcma...@gmail.com --

Re: Decoding JSON file using python

2015-05-27 Thread Karthik Sharma
I tried modifying the program as follows as per your suggestion.Doesn't seem to work. import simplejson as json import cjson

Re: Decoding JSON file using python

2015-05-27 Thread MRAB
On 2015-05-28 00:51, Karthik Sharma wrote: I tried modifying the program as follows as per your suggestion.Doesn't seem to work. import simplejson as json import cjson json_input = { msgType: 0, tid: 1, data: [{\Severity\:\warn\,\Subject\:\Reporting

Re: Decoding JSON file using python

2015-05-27 Thread Jon Ribbens
On 2015-05-27, Karthik Sharma karthik.sha...@gmail.com wrote: I tried modifying the program as follows as per your suggestion.Doesn't seem to work. That's because you didn't modify the program as per their suggestion, you made completely different changes that bore no relation to what they

Re: Decoding JSON file using python

2015-05-27 Thread Cameron Simpson
On 28May2015 01:38, Jon Ribbens jon+use...@unequivocal.co.uk wrote: On 2015-05-27, Karthik Sharma karthik.sha...@gmail.com wrote: I tried modifying the program as follows as per your suggestion.Doesn't seem to work. That's because you didn't modify the program as per their suggestion, you

Re: Decoding JSON file using python

2015-05-27 Thread random832
On Wed, May 27, 2015, at 19:51, Karthik Sharma wrote: I get the following error. Traceback (most recent call last): File test_json.py, line 23, in module print('message {} \n\n'.format(message['Message'])) TypeError: list indices must be integers, not str

Re: Decoding JSON file using python

2015-05-27 Thread random832
On Wed, May 27, 2015, at 18:23, Karthik Sharma wrote: The JSON structure is valid as shown by http://jsonlint.com/ I want to be able to access the different fields inside `data` such as `severity`, `subject` and also fields inside `tdetails` such as `CPUs` and `Product`. How do I do

Re: Decoding JSON file using python

2015-05-27 Thread MRAB
On 2015-05-27 23:23, Karthik Sharma wrote: I have the JSON structure shown below and the python code shown below to manipulate the JSON structure. import json json_input = { msgType: 0, tid: 1, data: [{\Severity\:\warn\,\Subject\:\Reporting

Re: Decoding JSON file using python

2015-05-27 Thread Cameron Simpson
On 27May2015 15:23, Karthik Sharma karthik.sha...@gmail.com wrote: I have the JSON structure shown below and the python code shown below to manipulate the JSON structure. import json json_input = { msgType: 0, tid: 1, data: [{\Severity\:\warn\,\Subject\:\Reporting