<?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: Convert CIM Object to JSON string in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669715#M74955</link>
    <description>&lt;P&gt;Well, that's kind of the problem with CIM. Arcane and not well documented.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;x = arcpy.cim.CreateCIMObjectFromClassName('CIMUniqueValueRenderer','V3')
y = arcpy.cim.GetJSONForCIMObject(x, 'V3')
print(y)

'''
{"sampleSize": 10000, "visualVariables": [], 
"colorRamp": {"colorSpace": {"type": "CIMColorSpace"}, "type": "CIMColorRamp"}, 
"defaultSymbol": {"primitiveOverrides": [], 
"symbol": {"type": "CIMSymbol"}, 
"minScale": 0.0, "maxScale": 0.0, 
"scaleDependentSizeVariation": [], 
"minDistance": 0.0, "maxDistance": 0.0, 
"type": "CIMSymbolReference"}, 
"defaultSymbolPatch": "Default", 
"fields": [], "groups": [], 
"useDefaultSymbol": false, 
"valueExpressionInfo": {"returnType": "Default", "type": "CIMExpressionInfo"}, 
"polygonSymbolColorTarget": "Fill", 
"authoringInfo": {"type": "CIMUniqueValueRendererAuthoringInfo"}, "type": "CIMUniqueValueRenderer"}
'''&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honestly I check out the &lt;A href="https://github.com/Esri/cim-spec/tree/809fb365d8d204d1fbdc51b3fab5bd17d88de2d1/docs/v3" target="_self"&gt;CIM's github reference&lt;/A&gt; and then spend a lot of time using the intellisense in the Python Window in Pro to figure out what I can do. Honestly I hadn't heard of that function before today.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Dec 2025 16:07:24 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2025-12-02T16:07:24Z</dc:date>
    <item>
      <title>Convert CIM Object to JSON string</title>
      <link>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669703#M74954</link>
      <description>&lt;P&gt;I'm writing a script to generate a UniqueValueRenderer from scratch using&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.cim.CreateCIMObjectFromClassName('CIMUniqueValueRenderer','V3')&lt;/P&gt;&lt;P&gt;Since this object contains a lot of other CIM objects, I have to make all those as well, but somewhere in there I'm missing something so when writing it into the layer definition, Pro will crash.&lt;/P&gt;&lt;P&gt;Is there a way I can take my newly created CIMUniqueValueRenderer object and convert it to a JSON string so I can see what it contains?&lt;/P&gt;&lt;P&gt;I found a reference to a function &lt;SPAN&gt;GetJSONForCIMObject in another &lt;A href="https://community.esri.com/t5/python-questions/how-to-create-a-cim-object-from-a-json-string-via/td-p/1343117" target="_blank" rel="noopener"&gt;post&lt;/A&gt;, but can find no such function in the ArcPy documentation.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 15:43:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669703#M74954</guid>
      <dc:creator>Pukawai</dc:creator>
      <dc:date>2025-12-02T15:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert CIM Object to JSON string</title>
      <link>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669715#M74955</link>
      <description>&lt;P&gt;Well, that's kind of the problem with CIM. Arcane and not well documented.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;x = arcpy.cim.CreateCIMObjectFromClassName('CIMUniqueValueRenderer','V3')
y = arcpy.cim.GetJSONForCIMObject(x, 'V3')
print(y)

'''
{"sampleSize": 10000, "visualVariables": [], 
"colorRamp": {"colorSpace": {"type": "CIMColorSpace"}, "type": "CIMColorRamp"}, 
"defaultSymbol": {"primitiveOverrides": [], 
"symbol": {"type": "CIMSymbol"}, 
"minScale": 0.0, "maxScale": 0.0, 
"scaleDependentSizeVariation": [], 
"minDistance": 0.0, "maxDistance": 0.0, 
"type": "CIMSymbolReference"}, 
"defaultSymbolPatch": "Default", 
"fields": [], "groups": [], 
"useDefaultSymbol": false, 
"valueExpressionInfo": {"returnType": "Default", "type": "CIMExpressionInfo"}, 
"polygonSymbolColorTarget": "Fill", 
"authoringInfo": {"type": "CIMUniqueValueRendererAuthoringInfo"}, "type": "CIMUniqueValueRenderer"}
'''&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honestly I check out the &lt;A href="https://github.com/Esri/cim-spec/tree/809fb365d8d204d1fbdc51b3fab5bd17d88de2d1/docs/v3" target="_self"&gt;CIM's github reference&lt;/A&gt; and then spend a lot of time using the intellisense in the Python Window in Pro to figure out what I can do. Honestly I hadn't heard of that function before today.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 16:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669715#M74955</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-12-02T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert CIM Object to JSON string</title>
      <link>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669776#M74956</link>
      <description>&lt;P&gt;Thank you for this! With some massaging of that output string I should be able to compare it to a .lyrx file and discover what's missing.&amp;nbsp; Now, if only intellisense worked in notebooks....&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 17:40:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1669776#M74956</guid>
      <dc:creator>Pukawai</dc:creator>
      <dc:date>2025-12-02T17:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert CIM Object to JSON string</title>
      <link>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1673752#M75009</link>
      <description>&lt;P&gt;There's a certain irony in how much I've revisited this page over the last two weeks to remind myself of how to get this information.&lt;/P&gt;&lt;P&gt;Hard agree on the notebook. Huge pain.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Dec 2025 20:10:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-cim-object-to-json-string/m-p/1673752#M75009</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-12-17T20:10:11Z</dc:date>
    </item>
  </channel>
</rss>

