ERROR 001558: Error parsing json file

256
3
Jump to solution
04-12-2024 08:58 AM
Rich
by
New Contributor II

Hi,

I am receiving the below error message when downloading json file from a feature layer collection. The script is running on a windows PC at work.

However, at home, on windows as well, the script works perfectly and the json file is parsed and loaded into a file geodatabase.

ERROR 001558: Error parsing json file <filename.json>. A general error when some thing is wrong with a Field. [<fieldname>].

Failed to execute (JSONToFeatures).

The field in question holds the global id.

I have compared the temp json files downloaded at home and on the work PC and they are exactly the same.

The code is being run in VS Code on both machines.

Thanks very much for any ideas anyone may have.

for lyr in itemObject.layers:

# output feature class name
out_fc = '{}'.format(re.sub(r'[^A-Za-z0-9]+', '', lyr.properties.name))
# TableName is now original name, minus any spaces.

# use query to return a feature set object
export = lyr.query(query="owner:" + gis.users.me.username, item_type="Feature Layer") # url of sub layer.
print("Create export for: {}".format(out_fc))

# Works fine to this point.
# The "export.save...." is the section that fails, as it tries to parse the json file.

export.save(os.path.join(gdblocation, gdbname), out_fc)  # save json file of layer to fgdb.

0 Kudos
1 Solution

Accepted Solutions
Clubdebambos
Occasional Contributor III

Hi @Rich 

When I switch machines where it worked on one and not the other, I initially check the API versions. Your home version might be a newer version that your work version.

import arcgis
print(arcgis.__version__)

If there are indeed both the same, we can then rule that out as a cause.

Cheers.

 

~ learn.finaldraftmapping.com

View solution in original post

0 Kudos
3 Replies
Clubdebambos
Occasional Contributor III

Hi @Rich 

When I switch machines where it worked on one and not the other, I initially check the API versions. Your home version might be a newer version that your work version.

import arcgis
print(arcgis.__version__)

If there are indeed both the same, we can then rule that out as a cause.

Cheers.

 

~ learn.finaldraftmapping.com
0 Kudos
Rich
by
New Contributor II

Hi @Clubdebambos,

Thanks very much for your response.

There is a difference in the arcgis versions.

Home: 2.2.0.1

Work: 2.1.0.2

I'll look into getting arcgis upgraded on my work PC and see if that resolves the issue.

Regards,

Rich.

Rich
by
New Contributor II

Hi,

I eventually managed to get my company to install an updated version of ArcGIS Pro.

This has resolved the json parsing issue.

Thanks very much for your help.

Rich.

0 Kudos