<?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: MultiValue Table from Json array in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295139#M89080</link>
    <description>&lt;P&gt;thank you that what i was looking for, it works perfectly now ! &lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2017 09:38:12 GMT</pubDate>
    <dc:creator>OualidAn</dc:creator>
    <dc:date>2017-10-16T09:38:12Z</dc:date>
    <item>
      <title>MultiValue Table from Json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295137#M89078</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I search a very longtime on internet and splunk doc and i didn't get what i want well i have this Json array :&lt;/P&gt;

&lt;P&gt;"LeagueResult": {&lt;BR /&gt;
        "Matchs": &lt;BR /&gt;
          {&lt;BR /&gt;
            "Team": "MANU",&lt;BR /&gt;
            "Date": "2017-09-25T00:00:00",&lt;BR /&gt;
            "Place": "HOM",&lt;BR /&gt;
            "Scored": 0,&lt;BR /&gt;
            "Conceded": 4,&lt;BR /&gt;
            "Difference": -4,&lt;BR /&gt;
          },&lt;BR /&gt;
         {&lt;BR /&gt;
            "Team": "CHE",&lt;BR /&gt;
            "Date": "2017-10-05T00:00:00",&lt;BR /&gt;
            "Place": "AWA",&lt;BR /&gt;
            "Scored": 5,&lt;BR /&gt;
            "Conceded": 4,&lt;BR /&gt;
            "Difference": 1,&lt;BR /&gt;
          },&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
            "Team": "TOT",&lt;BR /&gt;
            "Date": "2017-10-05T00:00:00",&lt;BR /&gt;
            "Place": "HOM",&lt;BR /&gt;
            "Scored": 1,&lt;BR /&gt;
            "Conceded": 1,&lt;BR /&gt;
            "Difference": 0,&lt;BR /&gt;
          }&lt;/P&gt;

&lt;P&gt;And I want to obtain this table or a look-like one :&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3621iE6DE0AC435E4A892/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I used spath function, mvzip function and mvexpand but I didn't succeed.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 09:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295137#M89078</guid>
      <dc:creator>OualidAn</dc:creator>
      <dc:date>2017-10-12T09:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: MultiValue Table from Json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295138#M89079</link>
      <description>&lt;P&gt;@OualidAn, your sample JSON seems to be incorrect each node inside LeagueResults should start with section like Matches in your first subset. Following is a run anywhere search based on your data. PS: first two pipes makeresults and eval generate the mock data, you would not require them with your actual data, provided JSON is formatted correctly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="{
    \"LeagueResult\": {
        \"Matchs\": {
            \"Team\": \"MANU\",
            \"Date\": \"2017-09-25T00:00:00\",
            \"Place\": \"HOM\",
            \"Scored\": 0,
            \"Conceded\": 4,
            \"Difference\": -4
        },
        \"Matchs\": {
            \"Team\": \"CHE\",
            \"Date\": \"2017-10-05T00:00:00\",
            \"Place\": \"AWA\",
            \"Scored\": 5,
            \"Conceded\": 4,
            \"Difference\": 1
        },
        \"Matchs\": {
            \"Team\": \"TOT\",
            \"Date\": \"2017-10-05T00:00:00\",
            \"Place\": \"HOM\",
            \"Scored\": 1,
            \"Conceded\": 1,
            \"Difference\": 0
        }
    }
}"
| spath
| fields - _raw _time
| rename LeagueResult.Matchs.* as *
| eval data=mvzip(mvzip(mvzip(mvzip(Place,Team),Conceded),Scored),Difference)
| fields data
| mvexpand data
| makemv data delim=","
| eval Place=mvindex(data,0)
| eval Team=mvindex(data,1)
| eval Conceded=mvindex(data,2)
| eval Scored=mvindex(data,3)
| eval Difference=mvindex(data,4)
| table Place Team Scored Conceded Difference
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk documentation on details for working with Multivalue fields:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 04:14:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295138#M89079</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-14T04:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: MultiValue Table from Json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295139#M89080</link>
      <description>&lt;P&gt;thank you that what i was looking for, it works perfectly now ! &lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 09:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/MultiValue-Table-from-Json-array/m-p/295139#M89080</guid>
      <dc:creator>OualidAn</dc:creator>
      <dc:date>2017-10-16T09:38:12Z</dc:date>
    </item>
  </channel>
</rss>

