<?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 array using spath or any other option in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190764#M37992</link>
    <description>&lt;P&gt;Thank you so much for your comment.&lt;BR /&gt;
Your solution works if field value is without double quotes. Like:&lt;BR /&gt;
 qValue=[{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"2","day":"Monday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"3","day":"Tuesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"4","day":"Wednesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"5","day":"Thursday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"6","day":"Friday"},{"id":null,"dayStart":"09:00","dayEnd":"17:00","dayOfWeek":"7","day":"Saturday"},{"id":null,"dayStart":null,"dayEnd":null,"dayOfWeek":"1","day":"Sunday"}]&lt;BR /&gt;
Not sure if there is a solution when we have json in double quotes.&lt;/P&gt;

&lt;P&gt;Also we have few logs where field value starts with [[{ instead of [{. In that case given solution does not work. Would really appreciated you can suggest some pointers for that as well.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2015 09:22:05 GMT</pubDate>
    <dc:creator>swatijha</dc:creator>
    <dc:date>2015-07-06T09:22:05Z</dc:date>
    <item>
      <title>How to parse JSON array using spath or any other option</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190762#M37990</link>
      <description>&lt;P&gt;Below is the log:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;qCode="SOME_CODE",&lt;BR /&gt;
qValue="[{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"2","day":"Monday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"3","day":"Tuesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"4","day":"Wednesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"5","day":"Thursday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"6","day":"Friday"},{"id":null,"dayStart":"09:00","dayEnd":"17:00","dayOfWeek":"7","day":"Saturday"},{"id":null,"dayStart":null,"dayEnd":null,"dayOfWeek":"1","day":"Sunday"}]"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;from which I have to show dayStart and dayEnd values. I have tried following query:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=myindex | spath | rename&lt;BR /&gt;
{}.{}.dayStart as value | table value&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;but this is not working. Is there a way that I can get values form JSON array?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 10:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190762#M37990</guid>
      <dc:creator>swatijha</dc:creator>
      <dc:date>2015-07-03T10:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON array using spath or any other option</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190763#M37991</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | spath input=qValue | rename {}.* AS * | table dayStart dayEnd
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jul 2015 14:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190763#M37991</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-03T14:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON array using spath or any other option</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190764#M37992</link>
      <description>&lt;P&gt;Thank you so much for your comment.&lt;BR /&gt;
Your solution works if field value is without double quotes. Like:&lt;BR /&gt;
 qValue=[{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"2","day":"Monday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"3","day":"Tuesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"4","day":"Wednesday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"5","day":"Thursday"},{"id":null,"dayStart":"08:00","dayEnd":"18:00","dayOfWeek":"6","day":"Friday"},{"id":null,"dayStart":"09:00","dayEnd":"17:00","dayOfWeek":"7","day":"Saturday"},{"id":null,"dayStart":null,"dayEnd":null,"dayOfWeek":"1","day":"Sunday"}]&lt;BR /&gt;
Not sure if there is a solution when we have json in double quotes.&lt;/P&gt;

&lt;P&gt;Also we have few logs where field value starts with [[{ instead of [{. In that case given solution does not work. Would really appreciated you can suggest some pointers for that as well.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2015 09:22:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190764#M37992</guid>
      <dc:creator>swatijha</dc:creator>
      <dc:date>2015-07-06T09:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON array using spath or any other option</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190765#M37993</link>
      <description>&lt;P&gt;I would classify any JSON or KeyValue data could be done&lt;BR /&gt;
 - Before Indexing&lt;BR /&gt;
 - After Indexing&lt;/P&gt;

&lt;P&gt;I prefer before indexing, as JSON is KV and when you display the data you get in "Interesting field section" automatically. Inorder to do that, just put in props.conf  something like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf   
[SPECIAL_EVENT]
NO_BINARY_CHECK = 1
TIME_PREFIX = "timestamp"  # or identify the tag within your JSON data
pulldown_type = 1
KV_MODE = JSON
BREAK_ONLY_BEFORE = (^{)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jul 2015 11:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190765#M37993</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2015-07-06T11:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON array using spath or any other option</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190766#M37994</link>
      <description>&lt;P&gt;You can easily remove the double-quotes like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=myindex | rex field=qValue mode=sed "s/\"//g" | spath input=qValue | rename {}.* AS * | table dayStart dayEnd
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that works, please "Accept" the answer and if there is another question, then please ask a new question.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 04:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-array-using-spath-or-any-other-option/m-p/190766#M37994</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-07T04:35:17Z</dc:date>
    </item>
  </channel>
</rss>

