<?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 JSON with spath command is not returning expected results. in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447938#M77892</link>
    <description>&lt;P&gt;The spath command works when your json data is in pure json format. You can use &lt;A href="https://jsonlint.com/"&gt;https://jsonlint.com/&lt;/A&gt; to confirm if you raw data is a valid json.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Sep 2018 21:41:16 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-09-10T21:41:16Z</dc:date>
    <item>
      <title>Parsing JSON with spath command is not returning expected results.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447937#M77891</link>
      <description>&lt;P&gt;I have tried to get after.merchantId a million different ways, but it always comes back blank.  I believe I'm missing the obvious:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Search String:
sourcetype="json" auditId=RECIPIENT_ADDED | spath | table _time, after.merchantId
...only _time has values, nothing else

sourcetype="json" auditId=RECIPIENT_ADDED | spath | rename after.merchantId as merchantId, after.leadDays as leadDays | eval x=mvzip(merchantId,leadDays) | table _time,merchantId,leadDays,x
...only _time has values, nothing else


Sample JSON:
{   
     @timestamp:     2018-09-09T19:05:50.077Z   
     @version:   1  
     actingProfileType:  ALL    
     after:  {"phoneNumber":"8005551212","recipientNumber":"************1111","merchantId":"111111112","paperPaymentEnabled":"true","leadDays":"5","Nickname":"Bob Evans","addressOnFile":"false","recipientName":"Bobby Evans","transferMethod":"PAYMENT","merchantZipRequired":"false","providerStatus":"ACTIVE","merchantName":"Bobby Evans"}    
     application:    BACKOFFICE 
     auditId:    RECIPIENT_ADDED    
     browserName:    Chrome 
     browserVersion:     68.0.3440.106  
     clientIp:   192.0.0.1  
     companyId:  11113  
     component:  PAYMENTS   
     instanceId:     1abc2345-67de      
     userId:     11111114   
     userSourceId:   2fgh3456-89ij      
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Sep 2018 20:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447937#M77891</guid>
      <dc:creator>jbutorac3</dc:creator>
      <dc:date>2018-09-10T20:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing JSON with spath command is not returning expected results.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447938#M77892</link>
      <description>&lt;P&gt;The spath command works when your json data is in pure json format. You can use &lt;A href="https://jsonlint.com/"&gt;https://jsonlint.com/&lt;/A&gt; to confirm if you raw data is a valid json.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 21:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447938#M77892</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-09-10T21:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing JSON with spath command is not returning expected results.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447939#M77893</link>
      <description>&lt;P&gt;1) Your JSON is missing required commas between key-value pairs. &lt;/P&gt;

&lt;P&gt;2) The colons in the time field are confusing the parsing algorithm.  In addition, it seems to be breaking each value and inserting space before periods, between pure alpha, pure decimal, and hyphens, and so on.  &lt;/P&gt;

&lt;P&gt;3) Parsing worked perfectly when we added the required commas and surrounded all keys and values with quotes, but beyond that, we couldn't tell you what other issues there might have been.  &lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 04:59:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Parsing-JSON-with-spath-command-is-not-returning-expected/m-p/447939#M77893</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-11-12T04:59:07Z</dc:date>
    </item>
  </channel>
</rss>

