<?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: Extract key-value pair from json object in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654295#M226085</link>
    <description>&lt;P&gt;mvindex wouldn't do anything to single valued&amp;nbsp;fields.id1,&amp;nbsp;fields.id3, etc. &amp;nbsp;To limit fields of interest, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fields" target="_blank" rel="noopener"&gt;fields&lt;/A&gt;&amp;nbsp;command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields fields.id1 fields.id3&lt;/LI-CODE&gt;&lt;P&gt;If you only want to display these fields in statistics tab, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Table" target="_blank" rel="noopener"&gt;table&lt;/A&gt;&amp;nbsp;command.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2023 17:00:02 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-08-14T17:00:02Z</dc:date>
    <item>
      <title>How to extract key-value pair from json object?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654286#M226081</link>
      <description>&lt;P&gt;I have a JSON event like this:&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;{
...otherfields...,
"fields": {
  "id1": 123,
  "id2": 456,
  "id3": 789,
...
},
...otherfields...
}&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;I want to extract some key-value pairs from the "fields" object, i.e., I want to see the extracted fields in the "interesting fields" section.&lt;/P&gt;
&lt;P&gt;For example, if I only want to extract id1 and id3, I should use&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;eval new_id1 = mvindex(fields.id1, 0)
eval new_id3 = mvindex(fields.id3, 0)&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;, right? Or is there another efficient way but not to use Foreach? I am new to the Splunk syntax so would appreciate any help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 17:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654286#M226081</guid>
      <dc:creator>itnewbie</dc:creator>
      <dc:date>2023-08-14T17:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key-value pair from json object</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654287#M226082</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath fields.id1 output="new_id1"
| spath fields.id3 output="new_id3"&lt;/LI-CODE&gt;&lt;P&gt;N.B. The spath command is built for extracting fields from JSON (and XML) structured data.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 14:59:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654287#M226082</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-14T14:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key-value pair from json object</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654295#M226085</link>
      <description>&lt;P&gt;mvindex wouldn't do anything to single valued&amp;nbsp;fields.id1,&amp;nbsp;fields.id3, etc. &amp;nbsp;To limit fields of interest, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fields" target="_blank" rel="noopener"&gt;fields&lt;/A&gt;&amp;nbsp;command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields fields.id1 fields.id3&lt;/LI-CODE&gt;&lt;P&gt;If you only want to display these fields in statistics tab, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Table" target="_blank" rel="noopener"&gt;table&lt;/A&gt;&amp;nbsp;command.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 17:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pair-from-json-object/m-p/654295#M226085</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-08-14T17:00:02Z</dc:date>
    </item>
  </channel>
</rss>

