python - Pythonic way to find what's wrong with a json file -


i working on script convert json data panadas.dataframe/numpy.array.

when json ok there no problem when there wrong got general error telling me not correct json format.

i looking pythonic know what's wrong json. can point error in json file.

for example:

with ths json, ok,

    [       {       "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       },       {        "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       },       {       "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       }     ] 

but this:

    [       {       "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       },       {        "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       }, []       {       "col1": value1,       "col2": value2,       "col3": value3,       "col4": value4,       "col5": value5,       "wpid": xxxxxx       }     ] 

i script return like:

  error: "},[]{" not json format. 

found myself:

import json  try:   data = json.loads(open("error_data.json").read()) except valueerror err:   print(err)  >> expecting , delimiter: line 28 column 5 (char 772) 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -