JSON parsing in python gives error -


I am trying to parse a JSON file that looks something like the following:

  {"result": [{"id": "63768E9b-1D 66-486A-BCDD-D391EFBE 94", "DT": "2013-08-03 T 13 : 01: 26.901J "," DT_U ":" 2013-08-03T 13: 01: 26.901Z "," Oz ":" NPPHI 7S "}, {" ID ":" 63768E9B-1D 66-486A-BCDD-D391EAFBE94 "," DT ":" 2013-08-03T16: 17: 33.280S "," DT_U ":" 2013-08-03T16: 17: 33.280 J "," Oz ":" 79J5J6U2R "}, {" id ":" F8B1B 9FB-7BCD -47 DF-89BD-241440BB 6270 "," DT ":" 2013-08- 06T00: 23: 43.562Z "," obj ":" Xf75BFtx4O "," Gender ": 2," Language ":" N " }]}   

There are too many entries in this file

Now when I try to load this file in Python by using JSON parser, / P>

  returns a traceback (most recent call): the file "e: \ test Py", line 8,   

[Finished with 0.9 with exit code 1]

My code is

  Import from json pprint Import pprint json_data = open ('data.json', 'r') for items in Jessondata Data = json.dumps (json_data) jsondata = data ["result"]: name = item.get ("ID") json_data. Close ()   

& lt; & Lt; & Lt;> gt; & Gt; & Gt; & Gt; & Gt; & Gt; & Gt; & Gt; Jsondata = data ["result"] for items in jsondata: name = item.get ("id") json_data.close ()

error which it is Now gives - & gt;

  traceback (most recent call final): file "e: \ test.py", line 7, & lt; Module & gt; The file "j:" , Line 338, return _default_decoder.decode (s) file in the load "C: \ python27 \ lib \ json \ decoder.py", line 365, decoded obj, end = self.raw_decode (s, idx = _w (s, 0) .end ()) File "C: \ python27 \ lib \ json \ decoder.py", line 381, raw_decode obj, end = self.scan_once (s, idx) Unicodecode Error: 'utf8' codec byte 0xc2 decoded Can not do in position 2: Invalid continuity byte [Exhaust code ends with 0.2 in 1] 1   

I know That it is related to some Unicode data. But how can I identify it?

If you are trying to dump a string that's the file that you are reading from You do not understand this sentence because the underlying operation is irresponsible instead try json.load () .

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -