<?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 parse JSON mvfield into a proper table with a different line for each node named for a value in the node in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516232#M87367</link>
    <description>&lt;LI-CODE lang="markup"&gt;...
| spath appliedConditionalAccessPolicies{} output=appliedConditionalAccessPolicies
| stats count by appliedConditionalAccessPolicies
| spath input=appliedConditionalAccessPolicies
| table as_you_like&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;"stats by" is used for JSON arrays.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Aug 2020 10:59:52 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-08-26T10:59:52Z</dc:date>
    <item>
      <title>How to parse JSON mvfield into a proper table with a different line for each node named for a value in the node</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/515817#M87342</link>
      <description>&lt;P&gt;I have run into this barrier a lot while processing Azure logs: I want to do something intuitive like &lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|stats count by appliedConditionalAccessPolicies{}.displayName, appliedConditionalAccessPolicies{}.result&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;but since there are multiple instances of each displayName-d policy per event and all of the sub-values that have the same name are MV-fielded together, my results are much less meaningful than I had intended.&lt;/P&gt;
&lt;P&gt;I'm sure the answer to this involves |spath, but I'm struggling to wrap the examples I see&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-json-tree-into-a-table/m-p/112429#M29536" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Getting-Data-In/Create-Table-from-json-data/m-p/334836#M61914" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;around my data.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stroud_bc_0-1598281993750.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10471iA9F9F90694DABCD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stroud_bc_0-1598281993750.png" alt="stroud_bc_0-1598281993750.png" /&gt;&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;Ideal result makes this:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|stats count by appliedConditionalAccessPolicies{}.displayName AS policy_name, appliedConditionalAccessPolicies{}.result AS result&lt;/LI-CODE&gt;
&lt;P&gt;produce something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;policy_name&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;application_policy&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;failure&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;12398&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;application_policy&amp;nbsp; &lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;success&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;9889898&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;phone_policy&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;success&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1238988&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 17:05:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/515817#M87342</guid>
      <dc:creator>stroud_bc</dc:creator>
      <dc:date>2020-08-24T17:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON mvfield into a proper table with a different line for each node named for a value in the node</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516087#M87359</link>
      <description>&lt;P&gt;Can you use spath to get your two mv arrays (displayName and result), then mvzip them to a new array, mvexpand that array to get new events, and do your stats on those events (perhaps splitting up the values in the new array to get displayName and result in separate columns again)?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 17:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516087#M87359</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-08-25T17:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON mvfield into a proper table with a different line for each node named for a value in the node</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516232#M87367</link>
      <description>&lt;LI-CODE lang="markup"&gt;...
| spath appliedConditionalAccessPolicies{} output=appliedConditionalAccessPolicies
| stats count by appliedConditionalAccessPolicies
| spath input=appliedConditionalAccessPolicies
| table as_you_like&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;"stats by" is used for JSON arrays.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 10:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516232#M87367</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-26T10:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON mvfield into a proper table with a different line for each node named for a value in the node</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516388#M87394</link>
      <description>&lt;P&gt;THANK YOU. I've been wrestling with spath for a long time and this example made a lot of things click for me. Exactly what I was looking for (and what I have been looking for when dealing with JSON for ages)&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 20:45:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-mvfield-into-a-proper-table-with-a-different/m-p/516388#M87394</guid>
      <dc:creator>stroud_bc</dc:creator>
      <dc:date>2020-08-26T20:45:22Z</dc:date>
    </item>
  </channel>
</rss>

