<?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 Find first matching node of json in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-first-matching-node-of-json/m-p/700280#M237656</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Based on the following json document, I want to find the value of "Geography" where City is input.&lt;/P&gt;&lt;P&gt;Here is the json:&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="javascript"&gt;{
    "Company" : "Microsoft",
    "Cloud" : "Azure",
    "DataCenters" : [
        {
            "Geography" : "USA",
            "Region" : "East",
            "City": "New York"
        },
        {
            "Geography" : "India",
            "Region" : "West",
            "City": "Ahmedabad"
        }, 
        {
            "Geography" : "USA",
            "Region" : "West",
            "City": "San Fransisco"
        },
        {
            "Geography" : "South Africa",
            "Region" : "West",
            "City": "Capetown"
        }
    ]
}&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;Can somebody please help me fetch this information. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 01:27:20 GMT</pubDate>
    <dc:creator>nainil0683</dc:creator>
    <dc:date>2024-09-27T01:27:20Z</dc:date>
    <item>
      <title>Find first matching node of json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-first-matching-node-of-json/m-p/700280#M237656</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Based on the following json document, I want to find the value of "Geography" where City is input.&lt;/P&gt;&lt;P&gt;Here is the json:&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="javascript"&gt;{
    "Company" : "Microsoft",
    "Cloud" : "Azure",
    "DataCenters" : [
        {
            "Geography" : "USA",
            "Region" : "East",
            "City": "New York"
        },
        {
            "Geography" : "India",
            "Region" : "West",
            "City": "Ahmedabad"
        }, 
        {
            "Geography" : "USA",
            "Region" : "West",
            "City": "San Fransisco"
        },
        {
            "Geography" : "South Africa",
            "Region" : "West",
            "City": "Capetown"
        }
    ]
}&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;Can somebody please help me fetch this information. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 01:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-first-matching-node-of-json/m-p/700280#M237656</guid>
      <dc:creator>nainil0683</dc:creator>
      <dc:date>2024-09-27T01:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Find first matching node of json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-first-matching-node-of-json/m-p/700282#M237657</link>
      <description>&lt;P&gt;Assuming you already have a token $City_tok$ from the input, mvexpand is the most traditional way to do it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=DataCenters{}
| mvexpand DataCenters{}
| spath input=DataCenters{}
| whree City == "$City_tok$"&lt;/LI-CODE&gt;&lt;P&gt;If mvexpand is a problem in your environment, there are other ways.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 01:53:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-first-matching-node-of-json/m-p/700282#M237657</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-27T01:53:29Z</dc:date>
    </item>
  </channel>
</rss>

