<?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 Looping through ArcGIS JSON Service and writing results to CSV in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/468999#M36608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a sample script that I am using as a proof of concept to loop through a JSON web-service and write the results to a CSV then table in file geodatabase. I am using my The ArcGIS Sample Server JSON web-service as an example.&amp;nbsp; The problem is that my script does not write all records to the CSV, however in this case only the last record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;requests
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;json
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;&lt;SPAN style="background-color: #344134;"&gt;urllib2&lt;/SPAN&gt;
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;csv
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy




url = &lt;SPAN style="color: #a5c261;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&lt;/SPAN&gt;parsed_json = json.load(&lt;SPAN style="background-color: #344134;"&gt;urllib2&lt;/SPAN&gt;.urlopen(&lt;SPAN style="color: #a5c261;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;))
details = {&lt;SPAN style="color: #a5c261;"&gt;'layers'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;}
headers = {&lt;SPAN style="color: #a5c261;"&gt;'Content-type'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'application/x-www-form-urlencoded'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'Accept'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'/'&lt;/SPAN&gt;}
response = requests.post(url&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #aa4926;"&gt;data&lt;/SPAN&gt;=json.dumps(details)&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #aa4926;"&gt;headers&lt;/SPAN&gt;=headers)


&lt;SPAN style="color: #808080;"&gt;# tell computer where to put CSV
&lt;/SPAN&gt;outfile_path=&lt;SPAN style="color: #a5c261;"&gt;'C:\Users\Administrator\PycharmProjects\untitled\json2fgdb.csv'
&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# open it up, the w means we will write to it
&lt;/SPAN&gt;writer = csv.writer(&lt;SPAN style="color: #8888c6;"&gt;open&lt;/SPAN&gt;(outfile_path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'wb'&lt;/SPAN&gt;))

&lt;SPAN style="color: #808080;"&gt;#create a list with headings for our columns
&lt;/SPAN&gt;headers = [&lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'id'&lt;/SPAN&gt;]

&lt;SPAN style="color: #808080;"&gt;#write the row of headings to our CSV file
&lt;/SPAN&gt;writer.writerow(headers)

&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;for &lt;/SPAN&gt;services &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;in &lt;/SPAN&gt;parsed_json [&lt;SPAN style="color: #a5c261;"&gt;"layers"&lt;/SPAN&gt;]:

&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#initialize the row
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row = []
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#add every 'cell' to the row list, identifying the item just like an index in a list
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;row.append(&lt;SPAN style="color: #8888c6;"&gt;str&lt;/SPAN&gt;(services[&lt;SPAN style="color: #a5c261;"&gt;'id'&lt;/SPAN&gt;]).encode(&lt;SPAN style="color: #a5c261;"&gt;'utf-8'&lt;/SPAN&gt;))
row.append(&lt;SPAN style="color: #8888c6;"&gt;str&lt;/SPAN&gt;(services[&lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;]).encode(&lt;SPAN style="color: #a5c261;"&gt;'utf-8'&lt;/SPAN&gt;))


&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#once you have all the cells in there, write the row to your csv
&lt;/SPAN&gt;writer.writerow(row)
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#increment our loop counter, now we're on the next time through the loop
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;i = &lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;i = i +&lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;f = &lt;SPAN style="color: #8888c6;"&gt;open&lt;/SPAN&gt;(outfile_path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'wb'&lt;/SPAN&gt;)
writer = csv.writer(f)

f.close()

&lt;SPAN style="color: #808080;"&gt;#Temporary Delete Function to Overwrite Table
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;if &lt;/SPAN&gt;arcpy.Exists(&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb\jsoncsv7"&lt;/SPAN&gt;):
&amp;nbsp; arcpy.Delete_management(&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb\jsoncsv7"&lt;/SPAN&gt;)



arcpy.TableToTable_conversion(&lt;SPAN style="color: #a5c261;"&gt;"C:\Users\Administrator\Desktop\json2gdb.csv"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"jsoncsv7"&lt;/SPAN&gt;)

&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;print &lt;/SPAN&gt;response.text&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;name,id&lt;/P&gt;&lt;P&gt;5,states&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to write all layer IDs and Names, not just the last one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:47:35 GMT</pubDate>
    <dc:creator>GeoffreyWest</dc:creator>
    <dc:date>2021-12-11T20:47:35Z</dc:date>
    <item>
      <title>Looping through ArcGIS JSON Service and writing results to CSV</title>
      <link>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/468999#M36608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a sample script that I am using as a proof of concept to loop through a JSON web-service and write the results to a CSV then table in file geodatabase. I am using my The ArcGIS Sample Server JSON web-service as an example.&amp;nbsp; The problem is that my script does not write all records to the CSV, however in this case only the last record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;requests
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;json
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;&lt;SPAN style="background-color: #344134;"&gt;urllib2&lt;/SPAN&gt;
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;csv
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy




url = &lt;SPAN style="color: #a5c261;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&lt;/SPAN&gt;parsed_json = json.load(&lt;SPAN style="background-color: #344134;"&gt;urllib2&lt;/SPAN&gt;.urlopen(&lt;SPAN style="color: #a5c261;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=json&amp;amp;pretty=true&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;))
details = {&lt;SPAN style="color: #a5c261;"&gt;'layers'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;}
headers = {&lt;SPAN style="color: #a5c261;"&gt;'Content-type'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'application/x-www-form-urlencoded'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'Accept'&lt;/SPAN&gt;: &lt;SPAN style="color: #a5c261;"&gt;'/'&lt;/SPAN&gt;}
response = requests.post(url&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #aa4926;"&gt;data&lt;/SPAN&gt;=json.dumps(details)&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #aa4926;"&gt;headers&lt;/SPAN&gt;=headers)


&lt;SPAN style="color: #808080;"&gt;# tell computer where to put CSV
&lt;/SPAN&gt;outfile_path=&lt;SPAN style="color: #a5c261;"&gt;'C:\Users\Administrator\PycharmProjects\untitled\json2fgdb.csv'
&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# open it up, the w means we will write to it
&lt;/SPAN&gt;writer = csv.writer(&lt;SPAN style="color: #8888c6;"&gt;open&lt;/SPAN&gt;(outfile_path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'wb'&lt;/SPAN&gt;))

&lt;SPAN style="color: #808080;"&gt;#create a list with headings for our columns
&lt;/SPAN&gt;headers = [&lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'id'&lt;/SPAN&gt;]

&lt;SPAN style="color: #808080;"&gt;#write the row of headings to our CSV file
&lt;/SPAN&gt;writer.writerow(headers)

&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;for &lt;/SPAN&gt;services &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;in &lt;/SPAN&gt;parsed_json [&lt;SPAN style="color: #a5c261;"&gt;"layers"&lt;/SPAN&gt;]:

&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#initialize the row
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row = []
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#add every 'cell' to the row list, identifying the item just like an index in a list
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;row.append(&lt;SPAN style="color: #8888c6;"&gt;str&lt;/SPAN&gt;(services[&lt;SPAN style="color: #a5c261;"&gt;'id'&lt;/SPAN&gt;]).encode(&lt;SPAN style="color: #a5c261;"&gt;'utf-8'&lt;/SPAN&gt;))
row.append(&lt;SPAN style="color: #8888c6;"&gt;str&lt;/SPAN&gt;(services[&lt;SPAN style="color: #a5c261;"&gt;'name'&lt;/SPAN&gt;]).encode(&lt;SPAN style="color: #a5c261;"&gt;'utf-8'&lt;/SPAN&gt;))


&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#once you have all the cells in there, write the row to your csv
&lt;/SPAN&gt;writer.writerow(row)
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#increment our loop counter, now we're on the next time through the loop
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;i = &lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;i = i +&lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;
&lt;/SPAN&gt;f = &lt;SPAN style="color: #8888c6;"&gt;open&lt;/SPAN&gt;(outfile_path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'wb'&lt;/SPAN&gt;)
writer = csv.writer(f)

f.close()

&lt;SPAN style="color: #808080;"&gt;#Temporary Delete Function to Overwrite Table
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;if &lt;/SPAN&gt;arcpy.Exists(&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb\jsoncsv7"&lt;/SPAN&gt;):
&amp;nbsp; arcpy.Delete_management(&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb\jsoncsv7"&lt;/SPAN&gt;)



arcpy.TableToTable_conversion(&lt;SPAN style="color: #a5c261;"&gt;"C:\Users\Administrator\Desktop\json2gdb.csv"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"C:\dev_folder\orginalDev.gdb"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"jsoncsv7"&lt;/SPAN&gt;)

&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;print &lt;/SPAN&gt;response.text&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;name,id&lt;/P&gt;&lt;P&gt;5,states&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to write all layer IDs and Names, not just the last one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:47:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/468999#M36608</guid>
      <dc:creator>GeoffreyWest</dc:creator>
      <dc:date>2021-12-11T20:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through ArcGIS JSON Service and writing results to CSV</title>
      <link>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/469000#M36609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like it is an indentation issue. The append statements and the writing to the csv happen only once after it has iterated through all of the layers.&amp;nbsp; That is probably why you're only getting the last one.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt; services &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt; parsed_json [&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;"layers"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;]:&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;row = []&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f6f6f6; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;row.append(str(services[&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; background-color: #f6f6f6;"&gt;'id'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000; background-color: #f6f6f6;"&gt;]).encode(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; background-color: #f6f6f6;"&gt;'utf-8'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000; background-color: #f6f6f6;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f6f6f6; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;row.append(str(services[&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;'name'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;]).encode(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;'utf-8'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f6f6f6; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.writerow(row)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:47:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/469000#M36609</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2021-12-11T20:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through ArcGIS JSON Service and writing results to CSV</title>
      <link>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/469001#M36610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked a charm. Thank you Bruce Bacia!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 19:25:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/looping-through-arcgis-json-service-and-writing/m-p/469001#M36610</guid>
      <dc:creator>GeoffreyWest</dc:creator>
      <dc:date>2015-02-05T19:25:44Z</dc:date>
    </item>
  </channel>
</rss>

