Jeff, here's Douglas Crockford's comment on why he removed comments from JSON: https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr-Andy
Hi, so far I didn't find any real Official JSON format (if that exist).I've found the ESRI JSON input format expected by a geoprocessing service for ArcGIS 10.0.http://help.arcgis.com/EN/arcgisserver/10.0/apis/rest/index.htmlSo I know exactly what the geoprocessing service expects.I've also seen how a featureSet should be sent to a geoprocessing service through the submitJob function of the esri.tasks.Geoprocessor.http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/geoprocessor.htmMy problem is to figure out, where does that geoprocessor find its toJson function for a featureSet.ESRI says that the format expected should be some like this :{ "geometryType" : "esriGeometryPoint", "spatialReference" : {"wkid" : 4326}, "features" : [ { "geometry" : {"x" : -104.44, "y" : 34.83}, "attributes" : {"Id" : 43, "Name" : "Feature 1"} }, { "geometry" : {"x" : -100.65, "y" : 33.69}, "attributes" : {"Id" : 67, "Name" : "Feature 2"} } ] }But then, the geoprocessor object create the JSON from my featureSet like this:{ "fields":[], "geometryType":"esriGeometryPoint", "features":[ { "geometry":{"x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}}, "attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true} } ], "sr":{"wkid":3400} }Althought the JSON.stringify() method give me this :{ "features":[ { "geometry":{"type":"point","x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}}, "symbol":null, "attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true}, "infoTemplate":{"title":"Main Camp","content":"Latitude: 56.123456<br>Longitude: -112.12345678"} } ], "geometryType":"esriGeometryPoint", "spatialReference":{"wkid":3400} }I've tried to call the service from the rest end point with both JSON featureSet and I found out why the JSON object created by the geoprocessor does not work. It simply that, as you can notice, the spatial reference from the geoprocessor is noted as "sr":{"wkid":3400} while form the stringify method it is noted as "spatialReference":{"wkid":3400} which is the expected format.I'm wondering if this is normal and there is just something I'm missing, or is it simply a bug from esri.tasks.geoprocessor.That is why I'd like to know what does the esri.tasks.geoprocessor uses for the purpose of converting FeatureSet to JSON and how can I work around that problem. If anyone has encountered that problem or has a hint on how to solve this, it'd be appreciated.Thank you
{ "geometryType" : "esriGeometryPoint", "spatialReference" : {"wkid" : 4326}, "features" : [ { "geometry" : {"x" : -104.44, "y" : 34.83}, "attributes" : {"Id" : 43, "Name" : "Feature 1"} }, { "geometry" : {"x" : -100.65, "y" : 33.69}, "attributes" : {"Id" : 67, "Name" : "Feature 2"} } ] }
{ "fields":[], "geometryType":"esriGeometryPoint", "features":[ { "geometry":{"x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}}, "attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true} } ], "sr":{"wkid":3400} }
{ "features":[ { "geometry":{"type":"point","x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}}, "symbol":null, "attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true}, "infoTemplate":{"title":"Main Camp","content":"Latitude: 56.123456<br>Longitude: -112.12345678"} } ], "geometryType":"esriGeometryPoint", "spatialReference":{"wkid":3400} }
"sr":{"wkid":3400}
"spatialReference":{"wkid":3400}
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.