<?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 extract a specific key and its values in a table? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423568#M74384</link>
    <description>&lt;P&gt;Sorry this is not a valid JSON. Also use code button on Splunk Answers. Since answer to your question would be dependent on the JSON structure. Based on the details provided,  does it look like the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "ObjectID":"001",
    "Properties":[{
        "name":"targetName",
        "value":"sample1"
    },
    {
        "name":"targetClass",
        "value":"class1"
    },
    {
        "name":"targetApp",
        "value":"App1"
    }]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even if it did, you will have multi-valued fields. for Name and Value. Try the following partial query that generates the data as per the question (&lt;CODE&gt;multivalued though&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    \"ObjectID\": \"001\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample1\"
        },{
        \"name\":\"targetClass\",
        \"value\":\"class1\"
        },{
        \"name\":\"targetApp\",
        \"value\":\"App1\"
        }],
}" 
| append 
    [| makeresults 
    | eval _raw="{
    \"ObjectID\": \"002\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample2\"
            },{
        \"name\":\"targetClass\",
        \"value\":\"class2\"
            },{
        \"name\":\"targetApp\",
        \"value\":\"App2\"
            }],
}"] 
| spath 
| fields - _time _raw 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since it results in multi-valued field which you have not reported in your question, there are couple of more steps I have used to convert them to single value. Append the following search query to the above to get single value Properties Name and Value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval zip=mvzip('Properties{}.name','Properties{}.value') 
| fields - "Properties{}.name" "Properties{}.value" 
| mvexpand zip 
| makemv zip delim="," 
| eval "Properties{}.name"=mvindex(zip,0), "Properties{}.value"=mvindex(zip,1) 
| fields - zip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Finally, through &lt;STRONG&gt;xyseries&lt;/STRONG&gt; you should be able to create Fields &lt;CODE&gt;targetApp, targetClass and targetName&lt;/CODE&gt; fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xyseries ObjectID Properties.name Properties.value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out the example and confirm. If it does not solve your issue, like stated before please share the JSON file sample data (mask/anonymize any sensitive information).&lt;/P&gt;

&lt;P&gt;Following is the combined run anywhere search query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    \"ObjectID\": \"001\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample1\"
        },{
        \"name\":\"targetClass\",
        \"value\":\"class1\"
        },{
        \"name\":\"targetApp\",
        \"value\":\"App1\"
        }],
}" 
| append 
    [| makeresults 
    | eval _raw="{
    \"ObjectID\": \"002\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample2\"
            },{
        \"name\":\"targetClass\",
        \"value\":\"class2\"
            },{
        \"name\":\"targetApp\",
        \"value\":\"App2\"
            }],
}"] 
| spath 
| fields - _time _raw 
| eval zip=mvzip('Properties{}.name','Properties{}.value') 
| fields - "Properties{}.name" "Properties{}.value" 
| mvexpand zip 
| makemv zip delim="," 
| eval "Properties{}.name"=mvindex(zip,0), "Properties{}.value"=mvindex(zip,1) 
| fields - zip
| xyseries ObjectID Properties.name Properties.value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Jun 2019 17:13:08 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2019-06-15T17:13:08Z</dc:date>
    <item>
      <title>How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423563#M74379</link>
      <description>&lt;P&gt;Hello I'm new to splunk search commands,&lt;BR /&gt;
My event is like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ObjectID: 001
Properties: [ [ -]
{[-]
 Name: targetName
 Value: sample 1       
}
{
}
{
}
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to display result set in table where &lt;CODE&gt;ObjectID&lt;/CODE&gt; and &lt;CODE&gt;targetName&lt;/CODE&gt; should be a column. Here, &lt;CODE&gt;targetName&lt;/CODE&gt; is the key and it has multiples values such as &lt;CODE&gt;sample1&lt;/CODE&gt; or &lt;CODE&gt;sample2&lt;/CODE&gt; or &lt;CODE&gt;sample3&lt;/CODE&gt;.&lt;BR /&gt;
Can you please help me display the table?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 20:33:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423563#M74379</guid>
      <dc:creator>nithyashreea</dc:creator>
      <dc:date>2019-06-14T20:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423564#M74380</link>
      <description>&lt;P&gt;Can you mention how this event is getting processed in fields, especially the Name:targetname along with its values??&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 07:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423564#M74380</guid>
      <dc:creator>amitm05</dc:creator>
      <dc:date>2019-06-15T07:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423565#M74381</link>
      <description>&lt;P&gt;@nithyashreea a valid json structure would help community experts assist you better. Please use the &lt;CODE&gt;Code button (101010)&lt;/CODE&gt; or shortcut &lt;CODE&gt;Ctrl+K&lt;/CODE&gt; while posting the JSON so that special characters do not escape.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 07:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423565#M74381</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-15T07:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423566#M74382</link>
      <description>&lt;P&gt;If I add the fields in search, it is processed as&lt;BR /&gt;
"Properties{}.Name"=targetName &lt;BR /&gt;
"Properties{}.Value"="sample1"&lt;BR /&gt;
There are many such Property names and values, but I have to fetch only the property with name "targetName" and its value (which is sample1 in this case).&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 16:05:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423566#M74382</guid>
      <dc:creator>nithyashreea</dc:creator>
      <dc:date>2019-06-15T16:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423567#M74383</link>
      <description>&lt;P&gt;Hi my raw text looks like this&lt;BR /&gt;
ObjectID:001 | Properties{}.Name=targetName Properties{}.Name=targetClass Properties{}.Name=targetApp|&lt;BR /&gt;
Properties{}.Value=sample1 Properties{}.Value=class1 Properties{}.Value=App1 |&lt;BR /&gt;
Hope this gives you an idea.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 16:20:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423567#M74383</guid>
      <dc:creator>nithyashreea</dc:creator>
      <dc:date>2019-06-15T16:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423568#M74384</link>
      <description>&lt;P&gt;Sorry this is not a valid JSON. Also use code button on Splunk Answers. Since answer to your question would be dependent on the JSON structure. Based on the details provided,  does it look like the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "ObjectID":"001",
    "Properties":[{
        "name":"targetName",
        "value":"sample1"
    },
    {
        "name":"targetClass",
        "value":"class1"
    },
    {
        "name":"targetApp",
        "value":"App1"
    }]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even if it did, you will have multi-valued fields. for Name and Value. Try the following partial query that generates the data as per the question (&lt;CODE&gt;multivalued though&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    \"ObjectID\": \"001\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample1\"
        },{
        \"name\":\"targetClass\",
        \"value\":\"class1\"
        },{
        \"name\":\"targetApp\",
        \"value\":\"App1\"
        }],
}" 
| append 
    [| makeresults 
    | eval _raw="{
    \"ObjectID\": \"002\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample2\"
            },{
        \"name\":\"targetClass\",
        \"value\":\"class2\"
            },{
        \"name\":\"targetApp\",
        \"value\":\"App2\"
            }],
}"] 
| spath 
| fields - _time _raw 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since it results in multi-valued field which you have not reported in your question, there are couple of more steps I have used to convert them to single value. Append the following search query to the above to get single value Properties Name and Value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval zip=mvzip('Properties{}.name','Properties{}.value') 
| fields - "Properties{}.name" "Properties{}.value" 
| mvexpand zip 
| makemv zip delim="," 
| eval "Properties{}.name"=mvindex(zip,0), "Properties{}.value"=mvindex(zip,1) 
| fields - zip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Finally, through &lt;STRONG&gt;xyseries&lt;/STRONG&gt; you should be able to create Fields &lt;CODE&gt;targetApp, targetClass and targetName&lt;/CODE&gt; fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xyseries ObjectID Properties.name Properties.value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out the example and confirm. If it does not solve your issue, like stated before please share the JSON file sample data (mask/anonymize any sensitive information).&lt;/P&gt;

&lt;P&gt;Following is the combined run anywhere search query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    \"ObjectID\": \"001\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample1\"
        },{
        \"name\":\"targetClass\",
        \"value\":\"class1\"
        },{
        \"name\":\"targetApp\",
        \"value\":\"App1\"
        }],
}" 
| append 
    [| makeresults 
    | eval _raw="{
    \"ObjectID\": \"002\",
    \"Properties\":[{
        \"name\":\"targetName\",
        \"value\":\"sample2\"
            },{
        \"name\":\"targetClass\",
        \"value\":\"class2\"
            },{
        \"name\":\"targetApp\",
        \"value\":\"App2\"
            }],
}"] 
| spath 
| fields - _time _raw 
| eval zip=mvzip('Properties{}.name','Properties{}.value') 
| fields - "Properties{}.name" "Properties{}.value" 
| mvexpand zip 
| makemv zip delim="," 
| eval "Properties{}.name"=mvindex(zip,0), "Properties{}.value"=mvindex(zip,1) 
| fields - zip
| xyseries ObjectID Properties.name Properties.value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Jun 2019 17:13:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423568#M74384</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-15T17:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423569#M74385</link>
      <description>&lt;P&gt;You can also put a backtick character &lt;PRE&gt;`&lt;/PRE&gt; before and after the code you want to display.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 18:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423569#M74385</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-15T18:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423570#M74386</link>
      <description>&lt;P&gt;I agree with the others, post an ACTUAL event in &lt;CODE&gt;code&lt;/CODE&gt; markup and a mockup of your desired output.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 23:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423570#M74386</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-15T23:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a specific key and its values in a table?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423571#M74387</link>
      <description>&lt;P&gt;Hello @nithyashreea,&lt;BR /&gt;
If you have valid JSON please check  &lt;CODE&gt;xpath&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jun 2019 15:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-a-specific-key-and-its-values-in-a-table/m-p/423571#M74387</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2019-06-16T15:29:18Z</dc:date>
    </item>
  </channel>
</rss>

