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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -