<?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 Working with periods in spath command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543220#M153884</link>
    <description>&lt;P&gt;I have a lot of json data that contains periods in the keys. I want to be able to expand one of the arrays in the data with the spath command.&amp;nbsp; It does not seem to work with a period in the json data in the simple example below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="
{
\"content\":{
\"jvm.memory\": [{\"num\":1.0},{\"num\":2.0}]
}
}"
| spath | spath path=content.jvm.memory{} output=event_data | mvexpand event_data | eval _raw=event_data | kv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The following query does work with an underscore in the key name.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="
{
\"content\":{
\"jvm_memory\": [{\"num\":1.0},{\"num\":2.0}]
}
}"
| spath | spath path=content.jvm_memory{} output=event_data | mvexpand event_data | eval _raw=event_data | kv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Are there any ways to work around the periods in the keys? Maybe some sort of mass replace of the periods in the key names only (not the values) or some sort of way to escape the periods in the spath command?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 15:35:25 GMT</pubDate>
    <dc:creator>Rjbeckwith</dc:creator>
    <dc:date>2021-03-10T15:35:25Z</dc:date>
    <item>
      <title>Working with periods in spath command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543220#M153884</link>
      <description>&lt;P&gt;I have a lot of json data that contains periods in the keys. I want to be able to expand one of the arrays in the data with the spath command.&amp;nbsp; It does not seem to work with a period in the json data in the simple example below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="
{
\"content\":{
\"jvm.memory\": [{\"num\":1.0},{\"num\":2.0}]
}
}"
| spath | spath path=content.jvm.memory{} output=event_data | mvexpand event_data | eval _raw=event_data | kv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The following query does work with an underscore in the key name.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="
{
\"content\":{
\"jvm_memory\": [{\"num\":1.0},{\"num\":2.0}]
}
}"
| spath | spath path=content.jvm_memory{} output=event_data | mvexpand event_data | eval _raw=event_data | kv&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Are there any ways to work around the periods in the keys? Maybe some sort of mass replace of the periods in the key names only (not the values) or some sort of way to escape the periods in the spath command?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 15:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543220#M153884</guid>
      <dc:creator>Rjbeckwith</dc:creator>
      <dc:date>2021-03-10T15:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Working with periods in spath command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543226#M153887</link>
      <description>&lt;P&gt;You can rename the field with dots in name.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="
{
\"content\":{
\"jvm.memory\": [{\"num\":1.0},{\"num\":2.0}]
}
}" 
| spath 
| rename content.jvm.memory{}.* as * 
| mvexpand num&lt;/LI-CODE&gt;&lt;P&gt;If this reply helps you, an upvote/like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543226#M153887</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-10T16:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Working with periods in spath command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543252#M153891</link>
      <description>&lt;P&gt;Thank you for the response. That did work for that simple example. Unfortunately my data has a lot of other fields underneath the array so I cannot specify the specific field to mvexpand.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In this slightly more complicated example I am not able to unroll by just specifying one field like in the solution you provided. (My dataset has many keys underneath the jvm_memory field so naming them manually won't work)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="
{
\"misc_field\": 0,
\"content\":{
\"jvm_memory\": [{\"num\":1.0, \"data\": {\"test\":2.4, \"test2\": 2.3}},{\"num\":2.0, \"data\":{\"test\":3, \"test2\": 2.3}}],
\"field_test2\": 3
}
}"
| spath | spath path=content.jvm_memory{} output=event_data | mvexpand event_data | eval _raw=event_data | kv&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This above yields what I want (The Json array elements have been split into separate rows and the keys have become columns)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543252#M153891</guid>
      <dc:creator>Rjbeckwith</dc:creator>
      <dc:date>2021-03-10T20:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Working with periods in spath command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543311#M153905</link>
      <description>&lt;P&gt;Then try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="
{
\"misc_field\": 0,
\"content\":{
\"jvm.memory\": [{\"num\":1.0, \"data\": {\"test\":2.4, \"test2\": 2.3}},{\"num\":2.0, \"data\":{\"test\":3, \"test2\": 2.3}}],
\"field_test2\": 3
}
}" 
| spath path=content output=content 
| eval content=replace(content, "jvm\.memory", "jvm_memory") 
| spath input=content path=jvm_memory{} output=event_data 
| mvexpand event_data 
| spath input=event_data&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, an upvote/like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 06:23:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543311#M153905</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-11T06:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Working with periods in spath command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543401#M153924</link>
      <description>&lt;P&gt;That worked thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:18:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Working-with-periods-in-spath-command/m-p/543401#M153924</guid>
      <dc:creator>Rjbeckwith</dc:creator>
      <dc:date>2021-03-11T15:18:40Z</dc:date>
    </item>
  </channel>
</rss>

