<?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 How to convert json to table in arcpy? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-convert-json-to-table-in-arcpy/m-p/1267476#M66606</link>
    <description>&lt;P&gt;I have data in JSON format that I'd like to convert to a table in ArcPy. I have used arcpy.CreateTable_Management() but this will require input in '.dbf' format only ? So please let me know all the possible ways to achieve it. Currently, I am converting the json data to Excel format, and then using Excel to Table conversion using ArcPy, I am able to do it.&lt;/P&gt;&lt;PRE&gt;arcpy.ExcelToTable_conversion(in_excel, out_table, sheet)&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Mar 2023 11:48:52 GMT</pubDate>
    <dc:creator>NiharSahoo</dc:creator>
    <dc:date>2023-03-14T11:48:52Z</dc:date>
    <item>
      <title>How to convert json to table in arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-convert-json-to-table-in-arcpy/m-p/1267476#M66606</link>
      <description>&lt;P&gt;I have data in JSON format that I'd like to convert to a table in ArcPy. I have used arcpy.CreateTable_Management() but this will require input in '.dbf' format only ? So please let me know all the possible ways to achieve it. Currently, I am converting the json data to Excel format, and then using Excel to Table conversion using ArcPy, I am able to do it.&lt;/P&gt;&lt;PRE&gt;arcpy.ExcelToTable_conversion(in_excel, out_table, sheet)&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2023 11:48:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-convert-json-to-table-in-arcpy/m-p/1267476#M66606</guid>
      <dc:creator>NiharSahoo</dc:creator>
      <dc:date>2023-03-14T11:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert json to table in arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-convert-json-to-table-in-arcpy/m-p/1278365#M67952</link>
      <description>&lt;P&gt;Assuming the JSON is formatted like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;'col_1'&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;3&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;],&lt;/SPAN&gt; &lt;SPAN class=""&gt;'col_2'&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;'a'&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;'b'&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;'c'&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;'d'&lt;/SPAN&gt;&lt;SPAN class=""&gt;]}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;You could convert the JSON to a pandas DataFrame using &lt;A href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html" target="_self"&gt;from_dict&lt;/A&gt;, then use &lt;A href="https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/#export-to-feature-class" target="_self"&gt;the ArcGIS API for Python to create a table/featureclass from it&lt;/A&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Something like this should work (note, this should work in theory but I did not test it, please read this as pseudocode, it's probably not the full solution and you might need to fill in the gaps as needed):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import json
import pandas as pd
import arcgis


with open("c:\myjson", "r") as f:
  data = json.loads(f)

df = pd.DataFrame.from_dict(data)  # Note, column data types will be inferred
                              # You may need/want to set them explicitly

df.spatial.to_featureclass("C:\workspace.gdb\mytbl")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 16:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-convert-json-to-table-in-arcpy/m-p/1278365#M67952</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2023-04-13T16:57:20Z</dc:date>
    </item>
  </channel>
</rss>

