<?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: SPL help to parse JSON into new fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647859#M224201</link>
    <description>&lt;P&gt;Sample picture of the goal output&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-06-21 at 8.12.09 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25942iFA4BBC07C6B4F9DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-06-21 at 8.12.09 PM.png" alt="Screen Shot 2023-06-21 at 8.12.09 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2023 01:13:11 GMT</pubDate>
    <dc:creator>Strangertinz</dc:creator>
    <dc:date>2023-06-22T01:13:11Z</dc:date>
    <item>
      <title>Is there a way for me to create a table output of the JSON keys?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647857#M224200</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hi Splunk Community!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a way for me to create a table output of the output of the json keys below &amp;amp; (possibly filter the keys to be a different name as well to represent their uniqueness).&amp;nbsp; Example below..&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Json data:&lt;/DIV&gt;
&lt;DIV&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "Key1": "Value1",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"Key2": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"subKey2_1": "sub value1 for key2",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"Manifest": [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "flight": "start",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "City": "Los Angeles",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"code": 7870,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"Inventory": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"snacks": 300,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"status": "full"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; },&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"flight": "end",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "City": "Las Vegas",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "code": 7470,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "Inventory": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"snacks": 56,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"status": "near empty"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"subKey2_3": "sub value3 for key2"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Key3": "Value3",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Key4": "Value4"&lt;BR /&gt;}&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I am looking to create a table with a single row of the fields and values below&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Field&amp;nbsp; = Value&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;city_origin = "Los Angeles"&lt;/DIV&gt;
&lt;DIV&gt;code_origin = 7870&lt;/DIV&gt;
&lt;DIV&gt;inventory_snacks_origin=300&lt;/DIV&gt;
&lt;DIV&gt;inventory_status_origin="full"&lt;/DIV&gt;
&lt;DIV&gt;city_end = "Las Vegas"&lt;/DIV&gt;
&lt;DIV&gt;code_end = 7470&lt;/DIV&gt;
&lt;DIV&gt;inventory_snacks_end=56&lt;/DIV&gt;
&lt;DIV&gt;inventory_status_end="near empty"&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Jun 2023 10:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647857#M224200</guid>
      <dc:creator>Strangertinz</dc:creator>
      <dc:date>2023-06-22T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: SPL help to parse JSON into new fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647859#M224201</link>
      <description>&lt;P&gt;Sample picture of the goal output&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-06-21 at 8.12.09 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25942iFA4BBC07C6B4F9DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2023-06-21 at 8.12.09 PM.png" alt="Screen Shot 2023-06-21 at 8.12.09 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 01:13:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647859#M224201</guid>
      <dc:creator>Strangertinz</dc:creator>
      <dc:date>2023-06-22T01:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: SPL help to parse JSON into new fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647871#M224206</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=Key2.Manifest{}
| mvexpand Key2.Manifest{}
| spath input=Key2.Manifest{}
| foreach City Inventory.* code
    [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_origin = if(flight == "start", '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', null()), &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_end = if(flight == "end", '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', null())]
| stats values(*_*) as *_*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="53.84375px" height="25px"&gt;City_end&lt;/TD&gt;&lt;TD width="68.03125px" height="25px"&gt;City_origin&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;Inventory.snacks_end&lt;/TD&gt;&lt;TD width="181.15625px" height="25px"&gt;Inventory.snacks_origin&lt;/TD&gt;&lt;TD width="162.8125px" height="25px"&gt;Inventory.status_end&lt;/TD&gt;&lt;TD width="175.78125px" height="25px"&gt;Inventory.status_origin&lt;/TD&gt;&lt;TD width="83.8125px" height="25px"&gt;code_end&lt;/TD&gt;&lt;TD width="96.765625px" height="25px"&gt;code_origin&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="53.84375px" height="47px"&gt;Las Vegas&lt;/TD&gt;&lt;TD width="68.03125px" height="47px"&gt;Los Angeles&lt;/TD&gt;&lt;TD width="40px" height="47px"&gt;56&lt;/TD&gt;&lt;TD width="181.15625px" height="47px"&gt;300&lt;/TD&gt;&lt;TD width="162.8125px" height="47px"&gt;near empty&lt;/TD&gt;&lt;TD width="175.78125px" height="47px"&gt;full&lt;/TD&gt;&lt;TD width="83.8125px" height="47px"&gt;7470&lt;/TD&gt;&lt;TD width="96.765625px" height="47px"&gt;7870&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Here is a data emulation you can play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "{
      \"Key1\": \"Value1\",
     \"Key2\": {
     \"subKey2_1\": \"sub value1 for key2\",
     \"Manifest\": [
         {
                \"flight\": \"start\",
                \"City\": \"Los Angeles\",
               \"code\": 7870,
               \"Inventory\": {
               \"snacks\": 300,
               \"status\": \"full\"
        }
    },
{
       \"flight\": \"end\",
      \"City\": \"Las Vegas\",
      \"code\": 7470,
      \"Inventory\": {
             \"snacks\": 56,
             \"status\": \"near empty\"
                      }
                }
         ],
     \"subKey2_3\": \"sub value3 for key2\"
      },
          \"Key3\": \"Value3\",
          \"Key4\": \"Value4\"
}"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 04:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/647871#M224206</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-06-22T04:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: SPL help to parse JSON into new fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/648019#M224236</link>
      <description>&lt;P&gt;This was perfect! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 02:31:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-for-me-to-create-a-table-output-of-the-JSON-keys/m-p/648019#M224236</guid>
      <dc:creator>Strangertinz</dc:creator>
      <dc:date>2023-06-23T02:31:33Z</dc:date>
    </item>
  </channel>
</rss>

