<?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>question Re: Can JOLT be used to decompose the value of the date time field in the following JSON in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/221507#M84470</link>
    <description>&lt;P&gt;@David Sargrad,&lt;/P&gt;&lt;P&gt;JOLT cannot do that for you. You need to first get the value of the issued field in a flowfile attribute(using EvaluateJsonPath), then you can use expression language functions on that attribute to extract the year, month, date and so on from that attribute. You can use expression language in JOLT. &lt;/P&gt;&lt;PRE&gt;[
	{
		"operation": "default",
		"spec": {
			"issued_year": "${date_attribute:toNumber():format('YYYY')}",
			"issued_month": "${date_attribute:toNumber():format('MM')}"
		}
	}
]&lt;/PRE&gt;&lt;P&gt;Assuming that date_attribute is the attribute containing the evaluated date.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Oct 2018 18:41:43 GMT</pubDate>
    <dc:creator>sohil2027</dc:creator>
    <dc:date>2018-10-19T18:41:43Z</dc:date>
    <item>
      <title>Can JOLT be used to decompose the value of the date time field in the following JSON</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/221506#M84469</link>
      <description>&lt;P&gt;The JSON I have looks like this:&lt;/P&gt;&lt;PRE&gt;{     
"year":2018,   
"type":"N",  
"issued":"2018-10-17T20:16:00.000Z",   
"affectedFIR":"ZOA",   
"minimumFL":"000"
}
&lt;/PRE&gt;&lt;P&gt;I'd like to figure out how to extract the value of issued, and decompose it into a JSON that looks like the following&lt;/P&gt;&lt;PRE&gt;{ 
"issued_year":"2018", 
"issued_month":"10", 
"issued_day":"17", 
"issued_hour":"20", 
"issued_minute":"16",
"issued_second":"00"
}&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Oct 2018 17:23:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/221506#M84469</guid>
      <dc:creator>dave_sargrad</dc:creator>
      <dc:date>2018-10-19T17:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can JOLT be used to decompose the value of the date time field in the following JSON</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/221507#M84470</link>
      <description>&lt;P&gt;@David Sargrad,&lt;/P&gt;&lt;P&gt;JOLT cannot do that for you. You need to first get the value of the issued field in a flowfile attribute(using EvaluateJsonPath), then you can use expression language functions on that attribute to extract the year, month, date and so on from that attribute. You can use expression language in JOLT. &lt;/P&gt;&lt;PRE&gt;[
	{
		"operation": "default",
		"spec": {
			"issued_year": "${date_attribute:toNumber():format('YYYY')}",
			"issued_month": "${date_attribute:toNumber():format('MM')}"
		}
	}
]&lt;/PRE&gt;&lt;P&gt;Assuming that date_attribute is the attribute containing the evaluated date.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2018 18:41:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/221507#M84470</guid>
      <dc:creator>sohil2027</dc:creator>
      <dc:date>2018-10-19T18:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can JOLT be used to decompose the value of the date time field in the following JSON</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/330704#M84471</link>
      <description>&lt;P&gt;This can be done by jolt like this:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;[&lt;BR /&gt;{&lt;BR /&gt;"operation": "modify-overwrite-beta",&lt;BR /&gt;"spec": {&lt;BR /&gt;"issued_year": "=substring(@(1,issued),0,4)",&lt;BR /&gt;"issued_month": "=substring(@(1,issued),5,7)",&lt;BR /&gt;"issued_day": "=substring(@(1,issued),8,10)",&lt;BR /&gt;"issued_hour": "=substring(@(1,issued),11,13)",&lt;BR /&gt;"issued_minute": "=substring(@(1,issued),14,16)",&lt;BR /&gt;"issued_second": "=substring(@(1,issued),17,19)"&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"operation": "shift",&lt;BR /&gt;"spec": {&lt;BR /&gt;"issued_year": "issued_year",&lt;BR /&gt;"issued_month": "issued_month",&lt;BR /&gt;"issued_day": "issued_day",&lt;BR /&gt;"issued_hour": "issued_hour",&lt;BR /&gt;"issued_minute": "issued_minute",&lt;BR /&gt;"issued_second": "issued_second"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 10:56:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-JOLT-be-used-to-decompose-the-value-of-the-date-time/m-p/330704#M84471</guid>
      <dc:creator>MvB</dc:creator>
      <dc:date>2021-11-22T10:56:45Z</dc:date>
    </item>
  </channel>
</rss>

