<?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: JSONToFeatures_conversion | issues with in_memory and memory in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033177#M60219</link>
    <description>&lt;P&gt;I'm treating that as a path to where that memory feature class is supposed to reside, with the env set these two are equivalent.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;json_in_memory = arcpy.Describe("json_output")

json_in_memory = arcpy.Describe("in_memory\json_output")&lt;/LI-CODE&gt;&lt;P&gt;I think the bigger issue here is that&amp;nbsp;&lt;EM&gt;JSONToFeatures_conversion&lt;/EM&gt; gets wonky when it is not writing to a "physical" space like a shapefile, GDB, or similar.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 22:12:46 GMT</pubDate>
    <dc:creator>feralcatcolonist_old</dc:creator>
    <dc:date>2021-03-04T22:12:46Z</dc:date>
    <item>
      <title>JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033084#M60211</link>
      <description>&lt;P&gt;So I think that there might be several problems here. JSONToFeatures does not seem to want to output to the "memory" space but it will write to "in_memory"; however, after writing, it does not show up as a feature class using ListFeatureClasses-- --even though it appears as such using describe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

#rename to your path, and replace .txt with .json
json_input = r"WHATEVERPATH\test.json"
arcpy.env.overwriteOutput = True

try:
    arcpy.env.workspace = "memory"
    arcpy.JSONToFeatures_conversion(json_input, "json_output")
except Exception as e:
    print(f"There's this 000206 Error when running the {arcpy.env.workspace} workspace:\n\n{e}")
    arcpy.env.workspace = "in_memory"
    arcpy.JSONToFeatures_conversion(json_input, "json_output")
    print(f"But it seems to work fine running the {arcpy.env.workspace} workspace")

print(f"\n\tThis item exists: {arcpy.Exists('json_output')}")
json_in_memory = arcpy.Describe("json_output")
print(f"\tThis item is a: {json_in_memory.dataType}")
print(f"\tThis item is located at: {json_in_memory.catalogPath}")

list_fc = arcpy.ListFeatureClasses()
print(f"\n\tBut, when we check our current workspace {arcpy.env.workspace}, it returns no feature classes {list_fc}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the Python Kernel from ArcGIS Pro 2.7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:47:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033084#M60211</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2021-03-04T21:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033146#M60215</link>
      <description>&lt;LI-CODE lang="python"&gt;if arcpy.Exists("json_output") #  ???
# do you mean
if arcpy.Exists(json_input)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:44:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033146#M60215</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-04T21:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033149#M60216</link>
      <description>&lt;P&gt;No, that was a convenience function that I threw in there to assist in running multiple times; I guess I could have set overwrite = True to avoid that confusion.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033149#M60216</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2021-03-04T21:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033162#M60218</link>
      <description>&lt;P&gt;well this has nothing to describe&lt;/P&gt;&lt;LI-CODE lang="python"&gt;json_in_memory = arcpy.Describe("json_output")&lt;/LI-CODE&gt;&lt;P&gt;I would suggest dumping the try except block and do something about the non-existent variable (which is just a string)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:55:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033162#M60218</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-04T21:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033177#M60219</link>
      <description>&lt;P&gt;I'm treating that as a path to where that memory feature class is supposed to reside, with the env set these two are equivalent.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;json_in_memory = arcpy.Describe("json_output")

json_in_memory = arcpy.Describe("in_memory\json_output")&lt;/LI-CODE&gt;&lt;P&gt;I think the bigger issue here is that&amp;nbsp;&lt;EM&gt;JSONToFeatures_conversion&lt;/EM&gt; gets wonky when it is not writing to a "physical" space like a shapefile, GDB, or similar.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 22:12:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1033177#M60219</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2021-03-04T22:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: JSONToFeatures_conversion | issues with in_memory and memory</title>
      <link>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1264627#M66987</link>
      <description>&lt;P&gt;For everyone playing along at home; this issue is half-fixed (at ArcGIS Pro 3.1.0). You can now use JSONToFeatures_conversion, but you still cannot ListFeatureClasses() within the memory workspace.&lt;/P&gt;&lt;P&gt;I'll update the sample to some accessible data:&lt;/P&gt;&lt;P&gt;&lt;A href="https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_lakes.geojson" target="_blank" rel="noopener"&gt;https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_lakes.geojson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

# you can grab this data from here https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_lakes.geojson
json_input = r"YOUR_PATH_HERE\ne_110m_lakes.geojson"
arcpy.env.overwriteOutput = True

try:
    arcpy.env.workspace = "memory"
    arcpy.JSONToFeatures_conversion(json_input, "json_output")
except Exception as e:
    print(f"There's this 000206 Error when running the {arcpy.env.workspace} workspace:\n\n{e}")
    arcpy.env.workspace = "in_memory"
    arcpy.JSONToFeatures_conversion(json_input, "json_output")
    print(f"But it seems to work fine running the {arcpy.env.workspace} workspace")

print(f"\n\tThis item exists: {arcpy.Exists('json_output')}")
json_in_memory = arcpy.Describe("json_output")
print(f"\tThis item is a: {json_in_memory.dataType}")
print(f"\tThis item is located at: {json_in_memory.catalogPath}")

list_fc = arcpy.ListFeatureClasses()
print(f"\n\tBut, when we check our current workspace {arcpy.env.workspace}, it returns no feature classes {list_fc}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="feralcatcolonist_0-1678124431273.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/64443i1743FA4A766C2852/image-size/medium?v=v2&amp;amp;px=400" role="button" title="feralcatcolonist_0-1678124431273.png" alt="feralcatcolonist_0-1678124431273.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jsontofeatures-conversion-issues-with-in-memory/m-p/1264627#M66987</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2023-03-06T17:49:40Z</dc:date>
    </item>
  </channel>
</rss>

