Can python GP services returns json data to client through REST?

Imagine I have a python GP service that creates buffers around points and then merge the polygons together. I would like to send the output in esri json format as the response of the REST request made by the javascript client.

The client could use ajax to make the REST request. How would I make the GP to return the json to the client when job is finished?

2 Answers 2


You can get the result of a GP Service in JSON by simply asking for the response format to be returned as JSON. You just need f=json in the request.

For example (emphasis added, but removes it from the clickable link), the following will output JSON. JSON Features actually, similiar output to what you'd get when doing your buffer-merge workflow.


  • ok so if the output is a feature class, the response format would be esri json? Commented Apr 29, 2016 at 11:27
  • Yes, thats how it works
    – KHibma
    Commented Apr 29, 2016 at 13:25

I think that this is possible as long as the gp service that you have dumps it as a json and then you can make the call to that output from your JS.

See this thread for more info.

RESTful Geoprocessing Service Request returns empty Result object without errors

  • Ok, so if I understand, it's kind of hack because you have to transform the json into string and use the Message parameter as the transfer channel... It was not designed to do it initialy. Commented Apr 28, 2016 at 16:25
  • I wouldn't say it's so much of a hack, because if you have a Python GP service you have the ability to dump your output as a JSON. But yes, to answer your question, the message parameter will consume that dumped JSON. Commented Apr 28, 2016 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.