<?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: How to extract values from nested json? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/529512#M149551</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/56406"&gt;@acharlieh&lt;/a&gt;&amp;nbsp;, but why does the following not work(to get the first child of MY_DETAILS)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MY_DETAILS{0}.FIELDNAME&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 09:17:32 GMT</pubDate>
    <dc:creator>chibulcu</dc:creator>
    <dc:date>2020-11-16T09:17:32Z</dc:date>
    <item>
      <title>How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212377#M62180</link>
      <description>&lt;P&gt;I have the below json for which I want to extract all the values of FIELDNAME.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"MY_DETAILS": [
        {
            "ACTION": "Add",
            "OLD_VALUES": "",
            "FIELDNAME": "ABCD",
            "TIME": "17-Feb-2016 1:08 PM",
            "NAME": "Jane Doe",
            "NEW_VALUEs": "",
            "NAME": "Jane1234"
        },
       {
            "ACTION": "Add",
            "OLD_VALUES": "",
            "FIELDNAME": "XYZ",
            "TIME": "17-Feb-2016 1:08 PM",
            "NAME": "Jane Doe 2",
            "NEW_VALUEs": "",
            "NAME": "Jane1234"
        },.................
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract values FIELDNAME. In this case, the search should return ABCD and XYZ&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 01:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212377#M62180</guid>
      <dc:creator>arnabsen1234</dc:creator>
      <dc:date>2016-02-19T01:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212378#M62181</link>
      <description>&lt;P&gt;If you have a syntactically correct and complete JSON object (your example is missing an opening &lt;CODE&gt;{&lt;/CODE&gt;, closing &lt;CODE&gt;]&lt;/CODE&gt;, and closing &lt;CODE&gt;}&lt;/CODE&gt;). If you're sending the data in using a sourcetype with props.conf configuration that has &lt;CODE&gt;INDEXED_EXTRACTIONS=json&lt;/CODE&gt; or &lt;CODE&gt;AUTO_KV_JSON=true&lt;/CODE&gt; or &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt; (like the built-in sourcetypes like &lt;CODE&gt;_json&lt;/CODE&gt; and &lt;CODE&gt;json_no_timestamp&lt;/CODE&gt; ) then that field is automatically extracted as &lt;CODE&gt;MY_DETAILS{}.FIELDNAME&lt;/CODE&gt; (indexed extractions -&amp;gt; index time extraction, the others are search time extractions). &lt;/P&gt;

&lt;P&gt;Additionally / alternatively, if you're pulling the json object from a field, you can use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/spath"&gt;spath command&lt;/A&gt; or &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions#Text_functions"&gt;spath eval function&lt;/A&gt; to extract the same values. (these give you the added benefit, of say you want to extract only the first FIELDNAME value (e.g. "ABCD"), you could actually specify indices like &lt;CODE&gt;| eval fieldname=spath(_raw,"MY_DETAILS{0}.FIELDNAME")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 01:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212378#M62181</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2016-02-19T01:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212379#M62182</link>
      <description>&lt;P&gt;I am not sending with props.conf configuration that has INDEXED_EXTRACTIONS=json or AUTO_KV_JSON=true or KV_MODE=json. &lt;/P&gt;

&lt;P&gt;The json which i have posted, it part of the whole json which has different KVP as well. &lt;/P&gt;

&lt;P&gt;I tried this &lt;STRONG&gt;&lt;EM&gt;| eval fieldname=spath(_raw,"MY_DETAILS{0}.FIELDNAME")&lt;/EM&gt;&lt;/STRONG&gt;  but it din work. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:52:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212379#M62182</guid>
      <dc:creator>arnabsen1234</dc:creator>
      <dc:date>2020-09-29T08:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212380#M62183</link>
      <description>&lt;P&gt;Didn't work how? If this is nested further then you need to include those levels when running spath. Without sharing the complete event I couldn't tell you exactly what that is, only make a best guess based on what you shared. Is the entire event json (in which case you'd use _raw) or just a part of it (in which case you'd extract the entire json object to a different field then run spath)? You need a complete json object (no extra characters, no missing characters), to leverage either form of spath effectively.&lt;/P&gt;

&lt;P&gt;You could also potentially use rex, with max_match=0 to match multiple times but you'd have to know the limits of your data to build that regular expression.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 05:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212380#M62183</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2016-02-19T05:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212381#M62184</link>
      <description>&lt;P&gt;try like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| spath input=json|rename FIELDNAME as "your_FIELDNAME" |...|fields your_FIELDNAME
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 10:05:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/212381#M62184</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2016-02-19T10:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/529512#M149551</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/56406"&gt;@acharlieh&lt;/a&gt;&amp;nbsp;, but why does the following not work(to get the first child of MY_DETAILS)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MY_DETAILS{0}.FIELDNAME&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-nested-json/m-p/529512#M149551</guid>
      <dc:creator>chibulcu</dc:creator>
      <dc:date>2020-11-16T09:17:32Z</dc:date>
    </item>
  </channel>
</rss>

