<?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 Can spath cater for missing values in an array? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-spath-cater-for-missing-values-in-an-array/m-p/357323#M105702</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a nested array and I want to compare values across &lt;/P&gt;

&lt;P&gt;I've a query that works, apart from when a value is missing (the whole JSON is not present rather than it is empty)&lt;/P&gt;

&lt;P&gt;The query snippet is &lt;CODE&gt;... | spath output=my_one  path=bean.test{}.one | spath output=my_two  path=bean.test{}.two ...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In the example with this data below I want my_two to have two values, 45 and null, not one value of 45&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    {test}
    {
          one: 23
          two: 45
         three: 12
    }
    {
          one: 34
          three: 67
   }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I use spath for this, or is there another way?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 16 Mar 2018 16:19:05 GMT</pubDate>
    <dc:creator>ewanbrown</dc:creator>
    <dc:date>2018-03-16T16:19:05Z</dc:date>
    <item>
      <title>Can spath cater for missing values in an array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-spath-cater-for-missing-values-in-an-array/m-p/357323#M105702</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a nested array and I want to compare values across &lt;/P&gt;

&lt;P&gt;I've a query that works, apart from when a value is missing (the whole JSON is not present rather than it is empty)&lt;/P&gt;

&lt;P&gt;The query snippet is &lt;CODE&gt;... | spath output=my_one  path=bean.test{}.one | spath output=my_two  path=bean.test{}.two ...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In the example with this data below I want my_two to have two values, 45 and null, not one value of 45&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    {test}
    {
          one: 23
          two: 45
         three: 12
    }
    {
          one: 34
          three: 67
   }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I use spath for this, or is there another way?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-spath-cater-for-missing-values-in-an-array/m-p/357323#M105702</guid>
      <dc:creator>ewanbrown</dc:creator>
      <dc:date>2018-03-16T16:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can spath cater for missing values in an array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-spath-cater-for-missing-values-in-an-array/m-p/357324#M105703</link>
      <description>&lt;P&gt;Multivalue fields in Splunk do not contain elements with null values, so there would never be an output field that had a "null" in a multivalue slot.&lt;/P&gt;

&lt;P&gt;Thus, if you want to compare to the two items, you are going to have to extract them individually as a workaround.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | spath output=my_one0 path=bean.test{0}.one 
  | spath output=my_one1 path=bean.test{1}.one 
  | spath output=my_two0 path=bean.test{0}.two 
  | spath output=my_two1 path=bean.test{1}.two
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 05:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-spath-cater-for-missing-values-in-an-array/m-p/357324#M105703</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-11-12T05:07:37Z</dc:date>
    </item>
  </channel>
</rss>

