<?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: Reading complexed nested Json in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585389#M203950</link>
    <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="{
	\"0\": {
		\"field1\": \"123\"
	},
	\"1\": {
		\"field2\": \"123\"
	},
	\"2\": {
		\"field3\": \"123\"
	},
	\"3\": {
		\"field4\": \"123\"
	},
	\"4\": {
		\"field5\": \"123\"
	}


}"
| spath
| foreach *.*
    [| eval startpath_count=if(isnull(startpath_count),mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),startpath_count+mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'))]
| stats sum(startpath_count) as startpath_count&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 16 Feb 2022 16:00:44 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-02-16T16:00:44Z</dc:date>
    <item>
      <title>Having trouble reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585361#M203936</link>
      <description>&lt;P&gt;Hi, struggling trying to count objects in a big json doc. I'm on version&amp;nbsp;&lt;SPAN&gt;8.0.5, so function json_keys is not available.&amp;nbsp;&lt;/SPAN&gt;&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="markup"&gt;{
	"0": {
		"field1": "123"
	},
	"1": {
		"field2": "123"
	},
	"2": {
		"field3": "123"
	},
	"3": {
		"field4": "123"
	},
	"4": {
		"field5": "123"
	}


}&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;This is a sample, I am able to get down to the path (startpath) with spath. What I'm trying to do is count the instances of the objects (0,1,2,3,4). I can't cleanly regex backwards as the real values names are not consistent.&amp;nbsp; &amp;nbsp;Thought I could do something like startpath{} and list them out , but the wildcards {} are not working anyway I try it. Thoughts, suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:50:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585361#M203936</guid>
      <dc:creator>chrisboy68</dc:creator>
      <dc:date>2022-02-16T15:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585369#M203940</link>
      <description>&lt;P&gt;Will this work for you?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="{\"startpath\": {
    \"0\": {
        \"ID\": \"123\"
     },
     \"1\": {
        \"ID\": \"123\"
     },
     \"2\": {
        \"ID\": \"123\"
     },
     \"3\": {
        \"ID\": \"123\"
     },
     \"4\": {
        \"ID\": \"123\"
     },
     \"4\": {
      \"ID\": \"123\"
   }
}
}"
| spath
| foreach startpath.*.ID
    [| eval startpath_&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;_count=mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]
| fields - startpath.*.*&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 14:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585369#M203940</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-16T14:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585373#M203943</link>
      <description>&lt;P&gt;sorry, i made the sample too easy. I updated my sample json. No, I need to count the instance of the object.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 14:57:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585373#M203943</guid>
      <dc:creator>chrisboy68</dc:creator>
      <dc:date>2022-02-16T14:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585378#M203944</link>
      <description>&lt;P&gt;Simplifying doesn't always help - in this instance, your example is not valid JSON format. Please can you update the example with a valid, and possibly more representative example?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585378#M203944</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-16T15:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585382#M203947</link>
      <description>&lt;P&gt;Ok I updated. Just know that the sample is deeply nested and I can get to this object starting with an initial spath.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585382#M203947</guid>
      <dc:creator>chrisboy68</dc:creator>
      <dc:date>2022-02-16T15:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585384#M203948</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="{
	\"0\": {
		\"field1\": \"123\"
	},
	\"1\": {
		\"field2\": \"123\"
	},
	\"2\": {
		\"field3\": \"123\"
	},
	\"3\": {
		\"field4\": \"123\"
	},
	\"4\": {
		\"field5\": \"123\"
	}


}"
| spath
| foreach *.*
    [| eval startpath_&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;_count=mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]
| stats sum(startpath_*_count) as startpath_*_count&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585384#M203948</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-16T15:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585388#M203949</link>
      <description>&lt;P&gt;Neat. Trying to follow. I need to have the total of all, not each count. So, in my example, the total is 5.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:54:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585388#M203949</guid>
      <dc:creator>chrisboy68</dc:creator>
      <dc:date>2022-02-16T15:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585389#M203950</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="{
	\"0\": {
		\"field1\": \"123\"
	},
	\"1\": {
		\"field2\": \"123\"
	},
	\"2\": {
		\"field3\": \"123\"
	},
	\"3\": {
		\"field4\": \"123\"
	},
	\"4\": {
		\"field5\": \"123\"
	}


}"
| spath
| foreach *.*
    [| eval startpath_count=if(isnull(startpath_count),mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),startpath_count+mvcount('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'))]
| stats sum(startpath_count) as startpath_count&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 16:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585389#M203950</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-16T16:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reading complexed nested Json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585398#M203953</link>
      <description>&lt;P&gt;I'm almost there. Now I need to count by each event, as this is totaling for every single event.&amp;nbsp; Looks like I just need to add a group by in the stats. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 16:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-trouble-reading-complexed-nested-Json/m-p/585398#M203953</guid>
      <dc:creator>chrisboy68</dc:creator>
      <dc:date>2022-02-16T16:36:23Z</dc:date>
    </item>
  </channel>
</rss>

