<?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: Adding fields to &amp;lt;class 'arcgis.features.layer.Table'&amp;gt;:  TypeError: Object of type PropertyMap is not JSON serializable in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-fields-to-lt-class-arcgis-features-layer/m-p/1653292#M11681</link>
    <description>&lt;P&gt;The solution was right on front of me...&lt;BR /&gt;&lt;BR /&gt;field_dict_list = []&lt;BR /&gt;for f in fields_to_add:&lt;BR /&gt;field_dict_list.append(dict(f))&lt;BR /&gt;&lt;BR /&gt;I just needed to convert the type of PropertyMap to a dict, append to a list. Then use the list of dictionaries to update the table.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Sep 2025 18:28:05 GMT</pubDate>
    <dc:creator>geo_sunriver</dc:creator>
    <dc:date>2025-09-25T18:28:05Z</dc:date>
    <item>
      <title>Adding fields to &lt;class 'arcgis.features.layer.Table'&gt;:  TypeError: Object of type PropertyMap is not JSON serializable</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-fields-to-lt-class-arcgis-features-layer/m-p/1653270#M11680</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I'm following the ArcGIS API for Python docs in attempts to add a long list of fields to a Table.&lt;/P&gt;&lt;P&gt;The code example I'm trying to replicate from the docs is here below:&lt;/P&gt;&lt;P&gt;-----------------------------------------------------&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; new_field = {&lt;BR /&gt;"fields": [&lt;BR /&gt;{&lt;BR /&gt;"name": "Loc Identifier",&lt;BR /&gt;"type": "esriFieldTypeString",&lt;BR /&gt;"alias": "safa",&lt;BR /&gt;"nullable": True,&lt;BR /&gt;"editable": True,&lt;BR /&gt;"length": 256,&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; res = fl.manager.add_to_definition(&lt;BR /&gt;json_dict=add_field&lt;BR /&gt;)&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; res&lt;/P&gt;&lt;P&gt;-----------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;My object of new fields which prints type of &amp;lt;class 'dict'&amp;gt; is shown here below:&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------------------&lt;/P&gt;&lt;P&gt;fields_to_add = []&lt;BR /&gt;for field in source_fields:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Check if the field should be ignored or if it already exists&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if field['name'].lower() not in fields_to_ignore_lower and field['name'].lower() not in target_field_names:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fields_to_add.append(field)&lt;/P&gt;&lt;P&gt;field_dict = {"fields":fields_to_add}&lt;BR /&gt;print(field_dict)&lt;/P&gt;&lt;PRE&gt;{'fields': [{
  "name": "PropID",
  "type": "esriFieldTypeInteger",
  "alias": "PropID",
  "sqlType": "sqlTypeOther",
  "nullable": true,
  "editable": true,
  "domain": null,
  "defaultValue": null
}, {
  "name": "SRLaneLot",
  "type": "esriFieldTypeString",
  "alias": "SRLaneLot",
  "sqlType": "sqlTypeOther",
  "length": 255,
  "nullable": true,
  "editable": true,
  "domain": null,
  "defaultValue": null
}, { ... continues on with the rest of the fields ...&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;When I try to use the 'add_to_definition' method I get the following type error:&lt;BR /&gt;&lt;BR /&gt;result = target_table.manager.add_to_definition(field_dict)&lt;BR /&gt;print(result)&lt;BR /&gt;&lt;BR /&gt;TypeError: Object of type PropertyMap is not JSON serializable&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As I type this out I realise the docs are showing the add_to_definition method for a type of FeatureLayer. Does anyone know how to add fields to a table that exists as a relationship class in ArcGIS Online?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 17:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-fields-to-lt-class-arcgis-features-layer/m-p/1653270#M11680</guid>
      <dc:creator>geo_sunriver</dc:creator>
      <dc:date>2025-09-25T17:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to &lt;class 'arcgis.features.layer.Table'&gt;:  TypeError: Object of type PropertyMap is not JSON serializable</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-fields-to-lt-class-arcgis-features-layer/m-p/1653292#M11681</link>
      <description>&lt;P&gt;The solution was right on front of me...&lt;BR /&gt;&lt;BR /&gt;field_dict_list = []&lt;BR /&gt;for f in fields_to_add:&lt;BR /&gt;field_dict_list.append(dict(f))&lt;BR /&gt;&lt;BR /&gt;I just needed to convert the type of PropertyMap to a dict, append to a list. Then use the list of dictionaries to update the table.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 18:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-fields-to-lt-class-arcgis-features-layer/m-p/1653292#M11681</guid>
      <dc:creator>geo_sunriver</dc:creator>
      <dc:date>2025-09-25T18:28:05Z</dc:date>
    </item>
  </channel>
</rss>

