Geoprocessing Service Output in Single Quotes, Not Double

802
1
Jump to solution
04-04-2017 10:09 AM
JasonLevine
Occasional Contributor II

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...):

html response

However, when viewing the json response, the result "value" object is in single quotes:

json response

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

0 Kudos
1 Solution

Accepted Solutions
JasonLevine
Occasional Contributor II

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))

View solution in original post

1 Reply
JasonLevine
Occasional Contributor II

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))