<?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: Parsing out a 32-char GUID from a nested JSON array in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-out-a-32-char-GUID-from-a-nested-JSON-array/m-p/327764#M60853</link>
    <description>&lt;P&gt;@nickchow, you can use spath to parse JSON data (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath&lt;/A&gt;)&lt;BR /&gt;
If you have enabled &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt; for your data your JSON data should already be extracted without the spath command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf#Field_extraction_configuration"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf#Field_extraction_configuration&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search to mock up data as per question, you can add the command from &lt;CODE&gt;| spath&lt;/CODE&gt; to your base search in your case: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval _raw="{
   \"myArr\":
     [
       \"redbull\",
       \"2;2cf77a02b5f047bbb1ae4522d9e614a6;OpAJa;1YdsW;3Z;zs\"
     ]
 }"
 |  spath
 |  rename "myArr{}" as "myArr"
 |  eval arr1=mvindex(myArr,0)
 |  eval arr2=mvindex(myArr,1)
 |  eval arr2=split(arr2,";")
 |  eval guid=mvindex(arr2,1)
 |  table _raw myArr arr1 arr2 guid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 Oct 2017 02:00:26 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-10-27T02:00:26Z</dc:date>
    <item>
      <title>Parsing out a 32-char GUID from a nested JSON array</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-out-a-32-char-GUID-from-a-nested-JSON-array/m-p/327763#M60852</link>
      <description>&lt;P&gt;I have a JSON object in Splunk that looks something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "myArr": [
    [
      "redbull",
      "2;2cf77a02b5f047bbb1ae4522d9e614a6;OpAJa;1YdsW;3Z;zs"
    ],
    ... &amp;lt;more arrays&amp;gt; ...
  ]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Pull out the nested array that has a first value of "redbull"&lt;/LI&gt;
&lt;LI&gt;Pull out the 2nd string from the nested array.&lt;/LI&gt;
&lt;LI&gt;Pull out the 2nd semicolon delimited item from that string.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;In this particular example, what I want is:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;2cf77a02b5f047bbb1ae4522d9e614a6&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Can anyone assist with this?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 00:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Parsing-out-a-32-char-GUID-from-a-nested-JSON-array/m-p/327763#M60852</guid>
      <dc:creator>nickchow</dc:creator>
      <dc:date>2017-10-27T00:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing out a 32-char GUID from a nested JSON array</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-out-a-32-char-GUID-from-a-nested-JSON-array/m-p/327764#M60853</link>
      <description>&lt;P&gt;@nickchow, you can use spath to parse JSON data (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath&lt;/A&gt;)&lt;BR /&gt;
If you have enabled &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt; for your data your JSON data should already be extracted without the spath command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf#Field_extraction_configuration"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf#Field_extraction_configuration&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search to mock up data as per question, you can add the command from &lt;CODE&gt;| spath&lt;/CODE&gt; to your base search in your case: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval _raw="{
   \"myArr\":
     [
       \"redbull\",
       \"2;2cf77a02b5f047bbb1ae4522d9e614a6;OpAJa;1YdsW;3Z;zs\"
     ]
 }"
 |  spath
 |  rename "myArr{}" as "myArr"
 |  eval arr1=mvindex(myArr,0)
 |  eval arr2=mvindex(myArr,1)
 |  eval arr2=split(arr2,";")
 |  eval guid=mvindex(arr2,1)
 |  table _raw myArr arr1 arr2 guid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Oct 2017 02:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Parsing-out-a-32-char-GUID-from-a-nested-JSON-array/m-p/327764#M60853</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-27T02:00:26Z</dc:date>
    </item>
  </channel>
</rss>

