Select to view content in your preferred language

Proper ESRI format for a JSON file

4693
5
10-17-2018 12:57 PM
JustinBridwell2
Frequent Contributor

I keep getting a 001558: Error parsing .json file. According to ESRI documentation for that error, "the JSON must have at least the geometryType, spatialReference, fields, and features (with geometry and attributes) property."

I checked my .json file and it appeared to have all that but I want to see an example of a proper format. Can anyone give me a proper example of hwo ESRI want a file to look. Below is what my .json file looks like:

{"displayFieldName": "CSLF_ID","fieldAliases": {...},"geometryType": "esriGeometryPolygon","spatialReference": {  "wkid": 102100,  "latestWkid": 3857},"fields": [...],"features": [  {"attributes": {...},   "geometry": {...}  },...]}
0 Kudos
5 Replies
JoshuaBixby
MVP Esteemed Contributor

What tool is generating the error and how are you calling it?

0 Kudos
JustinBridwell2
Frequent Contributor

I've tried this in both my Python script using:

arcpy.env.workspace = directory + "/gdb"

path = "<filepath for json file>"

fc = arcpy.JSONToFeatures_conversion(path, os.path.join("cslf.gdb", "cslf_{}".format(today)))

As well as using the manual JSONToFeatures tool in my toolbox in ArcMap (under Conversions) just using the same file. Both give me the exact same error.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I think An overview of the JSON toolset—Help | ArcGIS for Desktop is out of date.  I thought "fieldAliases" was deprecated back around 10.0.  Try removing that element and see if it works.

FeatureSet object—Common Data Types | ArcGIS for Developers 

JustinBridwell2
Frequent Contributor

The only difference that I can see in my JSON data is that the geometry comes after the attributes in features. But this was working up until yesterday. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

If it was working up until yesterday, then I am at a loss for why is stopped working.  Did you install any new Esri software, patches, or updates?  Have you tried rebooting the machine?

0 Kudos