<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: using GP service message parameter to return json data in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363431#M28749</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This got posted to the Python section. You're better off in &lt;A href="https://community.esri.com/space/2128"&gt;ArcGIS API for JavaScript&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;Just noticed your other similar thread. &lt;A href="https://community.esri.com/thread/176259"&gt;Can python GP services returns json data to client through REST?&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Apr 2016 18:06:55 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2016-04-28T18:06:55Z</dc:date>
    <item>
      <title>using GP service message parameter to return json data</title>
      <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363430#M28748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it a good practice to use the GP service message parameter to return json data as string when calling the GP from javascript client through REST?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="_jivemacro_uid_14618622188239894 jive_macro_code jive_text_macro" data-renderedposition="108_50_798_16" jivemacro_uid="_14618622188239894"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;AddMessage&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;json&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;dumps&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;data&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;))&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:51:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363430#M28748</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-04-28T16:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: using GP service message parameter to return json data</title>
      <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363431#M28749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This got posted to the Python section. You're better off in &lt;A href="https://community.esri.com/space/2128"&gt;ArcGIS API for JavaScript&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;Just noticed your other similar thread. &lt;A href="https://community.esri.com/thread/176259"&gt;Can python GP services returns json data to client through REST?&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:06:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363431#M28749</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-28T18:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: using GP service message parameter to return json data</title>
      <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363432#M28750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see why not.&amp;nbsp; When I create gp services for web applications, I generally use a single JSON string input and output which makes setting up parameter inputs and processing outputs easy.&amp;nbsp; I don't see why messages would be any different.&amp;nbsp; Just make sure you know your data.&amp;nbsp; If you are stringifying large objects (including messages), you are going to see a lot of data going across the pipe.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363432#M28750</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-04-28T18:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: using GP service message parameter to return json data</title>
      <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363433#M28751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Bill Daigle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your answer. Maybe you could help me a little further. I use a little python script at the end of my model builder to return the data in json format like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FC_In = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_set = arcpy.FeatureSet()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_set.load(FC_In)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(feature_set.JSON)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the client I call the GP Service with ajax and I have noticed that the response contains two members&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messages: [ ],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results: [ ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the messages member I have the json data from my GP, but results is an empty array. Why does the results empty? Would not be better to pass the json data inside the results parameter instead of the messages parameter? How can I do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:50:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363433#M28751</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-04-28T18:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: using GP service message parameter to return json data</title>
      <link>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363434#M28752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't use model builder, but I think I can point you in the right direction.&amp;nbsp; You need to add an output parameter to your model,&lt;/P&gt;&lt;P&gt;then do something along these lines:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.setParamterAsText(1,feature_set.JSON)&amp;nbsp; 
#or 
arcpy.setParameter(1,feature_set) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:56:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-gp-service-message-parameter-to-return-json/m-p/363434#M28752</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2021-12-11T16:56:23Z</dc:date>
    </item>
  </channel>
</rss>

