<?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 remove {} in Json extracted fields during search time without using rename in the search? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/590278#M103428</link>
    <description>&lt;P data-unlink="true"&gt;You can create &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/definecalcfields" target="_self"&gt;calculated fields&amp;nbsp;&lt;/A&gt;&amp;nbsp; to create a new field. You can also do the same eval inline in the search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Inline search:

| eval "item_description"=coalesce('item.description','item{}.description')

Props.conf (on search head):
[YourSourcetype]
EVAL-item_description = coalesce('item.description','item{}.description')&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 22 Mar 2022 17:22:19 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2022-03-22T17:22:19Z</dc:date>
    <item>
      <title>How to remove {} in Json extracted fields during search time without using rename in the search?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/589548#M103377</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;I have JSON data and sometimes it is nested and sometimes it is not, whenever it is a nested array I have a {} in the field name, and when it's not there is no {}. I'm trying to make a field alias to a common field name. But, I want to write a single alias to convert the field name if {} is present or not to a new name?&lt;BR /&gt;Any leads on how can I do it? (Either remove {} before the fields are extracted at search time or aliasing in the props.conf to a new name.)&lt;/P&gt;
&lt;P&gt;eg: items{}.description once, items.description the other other time --&amp;gt; rename to items.description during the search time without using rename command&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OR&lt;BR /&gt;remove {} before fields are extracted on the search head.&lt;BR /&gt;&lt;BR /&gt;P.S: I don't want to do index time field extraction.&lt;/P&gt;
&lt;P&gt;#fieldaliasing #json&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 04:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/589548#M103377</guid>
      <dc:creator>manikanta461</dc:creator>
      <dc:date>2022-03-18T04:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove {} in Json extracted fields during search time without using rename in the search?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/590155#M103421</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/92886"&gt;@manikanta461&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Try using spath in the search query and in the output parameter, you can set the fieldname that you want.&lt;/P&gt;&lt;P&gt;Related docs for spath command can be found here -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.5/SearchReference/Spath" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.5/SearchReference/Spath&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blog.avotrix.com/spath-command-in-splunk/" target="_blank"&gt;https://blog.avotrix.com/spath-command-in-splunk/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 08:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/590155#M103421</guid>
      <dc:creator>tshah-splunk</dc:creator>
      <dc:date>2022-03-22T08:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove {} in Json extracted fields during search time without using rename in the search?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/590278#M103428</link>
      <description>&lt;P data-unlink="true"&gt;You can create &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/definecalcfields" target="_self"&gt;calculated fields&amp;nbsp;&lt;/A&gt;&amp;nbsp; to create a new field. You can also do the same eval inline in the search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Inline search:

| eval "item_description"=coalesce('item.description','item{}.description')

Props.conf (on search head):
[YourSourcetype]
EVAL-item_description = coalesce('item.description','item{}.description')&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Mar 2022 17:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-in-Json-extracted-fields-during-search-time/m-p/590278#M103428</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-03-22T17:22:19Z</dc:date>
    </item>
  </channel>
</rss>

