<?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 with multiple array ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419142#M120492</link>
    <description>&lt;P&gt;try this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval payload="{    
        columnNames:    [
           usersession.city    
           Browser    
           name    
           count(duration)    
           median(duration)    
       ]    
        extrapolationLevel:     1    
        values:    [
         [    
            City1
            Browser1
            URL1    
            1    
            4795    
         ]    
         [
            City2
            Browser2
            URL2    
            1    
            9761    
         ]    
       ]    
 }
" 
|  rex field=payload "(?ms)values\:+\s+\[+\s+(?&amp;lt;value&amp;gt;.*?)\]+\s+}" max_match=0 
| eval k=split(value,"]")| fields k 
|  fields - _time
| mvexpand k
| makemv delim=" " k
| eval usersession.city =mvindex(k,2)
| eval Browser=mvindex(k,3)
| eval name=mvindex(k,4)
| eval count(duration)=mvindex(k,6)
| eval median(duration)=mvindex(k,8)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE : You might need to tinker with the values of the last 5 mvindex. Since i kinda copied from your text, count duration should ideally be mvindex(5) but I received a blank and hence switched to the next higher number. Try this code as is first and see the output.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 17:04:16 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-07-31T17:04:16Z</dc:date>
    <item>
      <title>How to parse JSON with multiple array ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419140#M120490</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Here is a sample :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   
     columnNames:   [
          usersession.city  
          Browser   
          name  
          count(duration)   
          median(duration)  
    ]   
     extrapolationLevel:     1  
     values:    [
        [   
         City1
         Browser1
         URL1   
         1  
         4795   
        ]   
        [
         City2
         Browser2
         URL2   
         1  
         9761   
        ]   
    ]   
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How to parse it into a table or chart ? I tried some request with spath command without success.&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:47:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419140#M120490</guid>
      <dc:creator>jegron</dc:creator>
      <dc:date>2019-07-31T12:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON with multiple array ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419141#M120491</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I tried to parse the sample without success. Are you sure the sample complies the rules for JSON formatting like the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{    
        "columnNames":  [
           "usersession.city",    
           "Browser",    
           "name",    
           "count(duration)",    
           "median(duration)"  
       ],    
        "extrapolationLevel":     1,   
        "values":    [
         [    
            "City1",
            "Browser1",
            "URL1",    
            1,    
            4795    
         ],    
         [
            "City2",
            "Browser2",
            "URL2",    
            1,    
            9761    
         ]    
       ]    
 }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jul 2019 16:33:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419141#M120491</guid>
      <dc:creator>jaime_ramirez</dc:creator>
      <dc:date>2019-07-31T16:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON with multiple array ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419142#M120492</link>
      <description>&lt;P&gt;try this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval payload="{    
        columnNames:    [
           usersession.city    
           Browser    
           name    
           count(duration)    
           median(duration)    
       ]    
        extrapolationLevel:     1    
        values:    [
         [    
            City1
            Browser1
            URL1    
            1    
            4795    
         ]    
         [
            City2
            Browser2
            URL2    
            1    
            9761    
         ]    
       ]    
 }
" 
|  rex field=payload "(?ms)values\:+\s+\[+\s+(?&amp;lt;value&amp;gt;.*?)\]+\s+}" max_match=0 
| eval k=split(value,"]")| fields k 
|  fields - _time
| mvexpand k
| makemv delim=" " k
| eval usersession.city =mvindex(k,2)
| eval Browser=mvindex(k,3)
| eval name=mvindex(k,4)
| eval count(duration)=mvindex(k,6)
| eval median(duration)=mvindex(k,8)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE : You might need to tinker with the values of the last 5 mvindex. Since i kinda copied from your text, count duration should ideally be mvindex(5) but I received a blank and hence switched to the next higher number. Try this code as is first and see the output.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 17:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419142#M120492</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-07-31T17:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON with multiple array ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419143#M120493</link>
      <description>&lt;P&gt;Yes, I copy pasted the Splunk visualization but the raw have the quotation mark like in your post.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 07:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419143#M120493</guid>
      <dc:creator>jegron</dc:creator>
      <dc:date>2019-08-01T07:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON with multiple array ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419144#M120494</link>
      <description>&lt;P&gt;hi @jegron &lt;/P&gt;

&lt;P&gt;Please let us know if your issue has been resolved and accept the answer if it significantly helped your resolution. Do not forget to add additional resolution details for the benefit of other form members.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 15:12:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-JSON-with-multiple-array/m-p/419144#M120494</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-19T15:12:22Z</dc:date>
    </item>
  </channel>
</rss>

