<?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 data at search-time? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278509#M53314</link>
    <description>&lt;P&gt;Hi Javier, &lt;/P&gt;

&lt;P&gt;I cannot specify any format while indexing data. for xml, if i specify xmlkv and use spath, it works fine. but, i am not sure about the json. &lt;/P&gt;</description>
    <pubDate>Wed, 10 Feb 2016 20:55:32 GMT</pubDate>
    <dc:creator>sdaruna</dc:creator>
    <dc:date>2016-02-10T20:55:32Z</dc:date>
    <item>
      <title>How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278507#M53312</link>
      <description>&lt;P&gt;I am getting different types of data from source. It can be XML or JSON. &lt;/P&gt;

&lt;P&gt;For XML, I am just indexing whole file and later at search-time, I am using xmlkv + xpath to parse and get the data that I want. &lt;/P&gt;

&lt;P&gt;For JSON, I need to index whole file, but is there a way that I can parse at search time similar to the above.?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 20:22:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278507#M53312</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-02-10T20:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278508#M53313</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Spath is your friend if you want automatic field extraction during search time for both XML and JSON type of data:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 20:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278508#M53313</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-10T20:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278509#M53314</link>
      <description>&lt;P&gt;Hi Javier, &lt;/P&gt;

&lt;P&gt;I cannot specify any format while indexing data. for xml, if i specify xmlkv and use spath, it works fine. but, i am not sure about the json. &lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 20:55:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278509#M53314</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-02-10T20:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278510#M53315</link>
      <description>&lt;P&gt;What do you mean you can't specify the format?  Is each file a valid json file?  Or does it contain individual json events?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 21:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278510#M53315</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2016-02-10T21:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278511#M53316</link>
      <description>&lt;P&gt;As said earlier, i can get xml file or json file. While indexing the data, i just need to load whole file. Because, end users need to see whole file. &lt;/P&gt;

&lt;P&gt;But, our processing framework needs splitted data. &lt;/P&gt;

&lt;P&gt;I have json as below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "Document": {
        "-xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
        "-xsi:noNamespaceSchemaLocation": "EPA_GEODATA_v1.0.xsd"
    },
    "FacilitySite": [{
        "LatitudeMeasure": "31.59",
        "LongitudeMeasure": "-85.278333",
        "Program": {
            "ProgramCommonName": "TRIS",
            "ProgramAcronymName": "TRIS"
        }
    }, {
        "LocalityName": "ABBEVILLE",
        "LocationAddressStateCode": "AL",
        "Program": {
            "ProgramCommonName": "TRIS",
            "ProgramAcronymName": "TRIS"
        }
    }]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;can i get child json document as below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Program": {
             "ProgramCommonName": "TRIS",
             "ProgramAcronymName": "TRIS"
         }
-----------------------------
"Program": {
             "ProgramCommonName": "TRIS",
             "ProgramAcronymName": "TRIS"
         }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2016 21:53:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278511#M53316</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-02-10T21:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON data at search-time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278512#M53317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Run the following query from Splunk and let me know if this is what you are looking for.&lt;BR /&gt;
If so, then simply apply the same logic to your events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count
| eval jsonIn = "
{
     \"Document\": {
         \"-xmlns:xsi\": \"http://www.w3.org/2001/XMLSchema-instance\",
         \"-xsi:noNamespaceSchemaLocation\": \"EPA_GEODATA_v1.0.xsd\"
     },
     \"FacilitySite\": [{
         \"LatitudeMeasure\": \"31.59\",
         \"LongitudeMeasure\": \"-85.278333\",
         \"Program\": {
             \"ProgramCommonName\": \"TRIS\",
             \"ProgramAcronymName\": \"TRIS\"
         }
     }, {
         \"LocalityName\": \"ABBEVILLE\",
         \"LocationAddressStateCode\": \"AL\",
         \"Program\": {
             \"ProgramCommonName\": \"TRIS\",
             \"ProgramAcronymName\": \"TRIS\"
         }
     }]
 }
"
| spath input=jsonIn path=FacilitySite{}.Program output=Program
| fields Program
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Program
{ "ProgramCommonName": "TRIS", "ProgramAcronymName": "TRIS" }
{ "ProgramCommonName": "TRIS", "ProgramAcronymName": "TRIS" } 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2016 22:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-JSON-data-at-search-time/m-p/278512#M53317</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-10T22:05:03Z</dc:date>
    </item>
  </channel>
</rss>

