Hello,
I have a geoprocessing service that returns a JSON object as a result. When viewing the HTML response through the service's rest endpoint, the result "value" object has its attributes in double quotes (columns, rows, bbox, xmin, ymin, etc...):
However, when viewing the json response, the result "value" object is in single quotes:
Is there a way to ensure that my geoprocessing service returns all attributes with double quotes in the json response?
In my code, I set the response like this:
output = {"bbox": bbox, "elevations": elevation_list, "rows": rows, "columns": columns}
#Set Output
arcpy.SetParameter(2, output)
Thanks,
Jason
Solved! Go to Solution.
Solved my own problem. I dumped the output object to a json string, and the double quotes are preserved:
output = {"bbox": bbox, "elevations": elevation_list, "rows": rows, "columns": columns}
#Set Output
arcpy.SetParameter(2, json.dumps(output))
Solved my own problem. I dumped the output object to a json string, and the double quotes are preserved:
output = {"bbox": bbox, "elevations": elevation_list, "rows": rows, "columns": columns}
#Set Output
arcpy.SetParameter(2, json.dumps(output))