<?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 Calculate Fields simple python expression in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-simple-python-expression/m-p/1369763#M77375</link>
    <description>&lt;P&gt;I am writing a small script taking Excel to a point layer in ArcGIS Pro. My question involves a small expression parsing the x and y coordinates from a single long string. The string is formatted as follows:&lt;/P&gt;&lt;P&gt;{"AddressCandidates":[{"location":{"spatialReference":{"wkid":4326},"x":-88.32831272050885,"y":42.00719348709284}}],"SelectedCandidate":{"location":{"spatialReference":{"wkid":4326},"x":-88.32831272050885,"y":42.00719348709284}},"LastGeocodedAddress":null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the calculate fields (multiple). I cannot use string length because it varies. I think I can identify the "x": and "y":&amp;nbsp; using message.find&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a student trying to learn, any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2024 19:35:05 GMT</pubDate>
    <dc:creator>ElijahLebo</dc:creator>
    <dc:date>2024-01-12T19:35:05Z</dc:date>
    <item>
      <title>Calculate Fields simple python expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-simple-python-expression/m-p/1369763#M77375</link>
      <description>&lt;P&gt;I am writing a small script taking Excel to a point layer in ArcGIS Pro. My question involves a small expression parsing the x and y coordinates from a single long string. The string is formatted as follows:&lt;/P&gt;&lt;P&gt;{"AddressCandidates":[{"location":{"spatialReference":{"wkid":4326},"x":-88.32831272050885,"y":42.00719348709284}}],"SelectedCandidate":{"location":{"spatialReference":{"wkid":4326},"x":-88.32831272050885,"y":42.00719348709284}},"LastGeocodedAddress":null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the calculate fields (multiple). I cannot use string length because it varies. I think I can identify the "x": and "y":&amp;nbsp; using message.find&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a student trying to learn, any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 19:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-simple-python-expression/m-p/1369763#M77375</guid>
      <dc:creator>ElijahLebo</dc:creator>
      <dc:date>2024-01-12T19:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Fields simple python expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-simple-python-expression/m-p/1369766#M77377</link>
      <description>&lt;P&gt;Your data is in a format called JSON which can be unpacked easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
import json

your_string = 'your JSON coordinate string'

data = json.loads(your_string)

x = data["AddressCandidates"][0]["location"]["x"]
y = data["AddressCandidates"][0]["location"]["y"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 19:56:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-simple-python-expression/m-p/1369766#M77377</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2024-01-12T19:56:22Z</dc:date>
    </item>
  </channel>
</rss>

