Can anyone spot the issue with this input .json file?
arcpy.JSONToFeatures_conversion fails in both a .py script and in ArcGIS Desktop 10.8.1 JSONToFeatures toolbox.
py script error: "EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host"
Toolbox error: no message specified but the process fails with the Background Processing window appearing stating the operations did not complete successfully due to error and to tell ESRI's GP team about it.
{
"features": [
[
{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081377,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
}
],
[
{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081388,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
}
]
],
"fieldAliases": {
"location_timestamp": "location_timestamp",
"vehicleName": "vehicleName",
"deviceId": "deviceId",
"OBJECTID": "OBJECTID"
},
"fields": [
{
"alias": "OBJECTID",
"type": "esriFieldTypeOID",
"name": "OBJECTID"
},
{
"alias": "deviceId",
"length": 50,
"type": "esriFieldTypeString",
"name": "deviceId"
},
{
"alias": "vehicleName",
"length": 50,
"type": "esriFieldTypeString",
"name": "vehicleName"
},
{
"alias": "location_timestamp",
"length": 8,
"type": "esriFieldTypeDate",
"name": "location_timestamp"
}
],
"displayFieldName": "vehicleName",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"geometryType": "esriGeometryPoint"
}
Solved! Go to Solution.
not sure about the extra set of square brackets on "features":
{
"features": [{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081377,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
},
{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081388,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
}
],
"fieldAliases": {
"location_timestamp": "location_timestamp",
"vehicleName": "vehicleName",
"deviceId": "deviceId",
"OBJECTID": "OBJECTID"
},
"fields": [{
"alias": "OBJECTID",
"type": "esriFieldTypeOID",
"name": "OBJECTID"
},
{
"alias": "deviceId",
"length": 50,
"type": "esriFieldTypeString",
"name": "deviceId"
},
{
"alias": "vehicleName",
"length": 50,
"type": "esriFieldTypeString",
"name": "vehicleName"
},
{
"alias": "location_timestamp",
"length": 8,
"type": "esriFieldTypeDate",
"name": "location_timestamp"
}
],
"displayFieldName": "vehicleName",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"geometryType": "esriGeometryPoint"
}
not sure about the extra set of square brackets on "features":
{
"features": [{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081377,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
},
{
"geometry": {
"y": -81.3515715,
"x": 27.941971
},
"attributes": {
"location_timestamp": 1646081388,
"vehicleName": "Truck1",
"deviceId": "350200694388663"
}
}
],
"fieldAliases": {
"location_timestamp": "location_timestamp",
"vehicleName": "vehicleName",
"deviceId": "deviceId",
"OBJECTID": "OBJECTID"
},
"fields": [{
"alias": "OBJECTID",
"type": "esriFieldTypeOID",
"name": "OBJECTID"
},
{
"alias": "deviceId",
"length": 50,
"type": "esriFieldTypeString",
"name": "deviceId"
},
{
"alias": "vehicleName",
"length": 50,
"type": "esriFieldTypeString",
"name": "vehicleName"
},
{
"alias": "location_timestamp",
"length": 8,
"type": "esriFieldTypeDate",
"name": "location_timestamp"
}
],
"displayFieldName": "vehicleName",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"geometryType": "esriGeometryPoint"
}
Good eye. Thank you!
I'm attempting to transform a XML response from a non-spatial api that I've got to basically rebuild into well-formatted json and it looks like I've got an improper list-build process going on somewhere that generates the json. Your correction looks like it should work.
JSON drives me nuts. Maybe ambitious to mark it as correct if not tested!
Well... if you're up to taking a stab at my list-build problem I can keep this thread going! 🙂
Ah if it works as a step in a bigger problem I'll keep the solve. Probably better to do a new thread for a new problem. Would get more interaction also.
heh.... No problem. Actually I think I've worked it out. But yep my squigglies perception is about maxed out for the day!
Thanks for the answer it helped.