<?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: need assistance with splunk tojson in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701244#M237884</link>
    <description>&lt;P&gt;Agreed. I will mark this as closed and raise a new question for what am trying to do. Thanks for your help&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2024 22:48:41 GMT</pubDate>
    <dc:creator>sdkp03</dc:creator>
    <dc:date>2024-10-07T22:48:41Z</dc:date>
    <item>
      <title>need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700745#M237754</link>
      <description>&lt;P&gt;I have a splunk query which generates output in csv/table format. I wanted to convert this to a json format before writing it into a file. tojson does the job of converting. However the fileds are not in the order I expect it to be. Table output:&lt;/P&gt;&lt;P&gt;timestamp,Subject,emailBody,operation --&amp;gt; resulting JSON output is in the order subject,emailbody,operation,timestamp. How do I manipulate tojson to write fields in this order or is there an alternate way of getting json output as expected?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 07:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700745#M237754</guid>
      <dc:creator>sdkp03</dc:creator>
      <dc:date>2024-10-02T07:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700757#M237755</link>
      <description>&lt;P&gt;I think it is not possible to change the order of the fields with tojson command.&lt;/P&gt;&lt;P&gt;But try to create a json object with eval and json_object function maybe that accomplish your goal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...your search...&lt;BR /&gt;|eval my_json_object=("&lt;SPAN&gt;timestamp",timestamp,"Subject",Subject,"emailBody",emailBody,"operation",operation)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 09:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700757#M237755</guid>
      <dc:creator>PaulPanther</dc:creator>
      <dc:date>2024-10-02T09:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700764#M237756</link>
      <description>&lt;P&gt;Json is a structured format so the order of fields should not matter for the recipient. After all you will be addressing the fields by their names. Unless you're manipulating that json on the receiving end using something not fit for json processing. In that case maybe json is not the best format choice.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 11:18:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700764#M237756</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-10-02T11:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700784#M237760</link>
      <description>&lt;P&gt;JSON is a structure that does not require any specific order of key. &amp;nbsp;If your downstream application has this requirement, they are noncompliant to the standard. &amp;nbsp;You don't have to make any change. &amp;nbsp;Demand that your downstream developer make change.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 15:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/700784#M237760</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-10-02T15:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701136#M237861</link>
      <description>&lt;P&gt;This was my last fall back option as I have multiple fields and the query would become lengthy. This also gives me the flexibility to add extra fields to the _raw event. I am just assuming that splunk has some inbuilt solution that I might be missing&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 00:17:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701136#M237861</guid>
      <dc:creator>sdkp03</dc:creator>
      <dc:date>2024-10-07T00:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701138#M237862</link>
      <description>&lt;P&gt;I had same understanding, thanks for confirming that. I am asked to modify the raw event that we receive in JSON format to include new key value pair and to replace the value of one of the field value for a specific key.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 00:25:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701138#M237862</guid>
      <dc:creator>sdkp03</dc:creator>
      <dc:date>2024-10-07T00:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701150#M237866</link>
      <description>&lt;P&gt;Wait a second. Firstly you've been asking about "sorting" json fields on output of the search (at least that's how I understood your question). Now you're saying you want to modify _raw event. By "modifying" I understand that you want to do it before the event is written to an index. Manipulating structured data with just regexes is not a very good idea (maybe except for very easy cases but even then I'd be very careful).&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 07:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701150#M237866</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-10-07T07:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: need assistance with splunk tojson</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701244#M237884</link>
      <description>&lt;P&gt;Agreed. I will mark this as closed and raise a new question for what am trying to do. Thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 22:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-assistance-with-splunk-tojson/m-p/701244#M237884</guid>
      <dc:creator>sdkp03</dc:creator>
      <dc:date>2024-10-07T22:48:41Z</dc:date>
    </item>
  </channel>
</rss>

