<?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: Nifi - How to add key:value to json in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/200909#M162924</link>
    <description>&lt;P&gt;In addition to &lt;A rel="user" href="https://community.cloudera.com/users/355/bhagan.html" nodeid="355"&gt;@bhagan&lt;/A&gt;'s answer, as of NiFi 1.2.0 (due to &lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-3010"&gt;NIFI-3010&lt;/A&gt;), you can use NiFi Expression Language in JOLT specifications, so with a JoltTransformJSON processor you could have the following Chain spec:&lt;/P&gt;&lt;PRE&gt;[{
  "operation": "default",
  "spec": {
    "*": {
      "ctime": "${now()}"
    }
  }
}]&lt;/PRE&gt;&lt;P&gt;If you want the &lt;EM&gt;ctime&lt;/EM&gt; field to contain a string with the number of milliseconds since Epoch, you can use now():toNumber() instead of just now().  If you want an actual numeric value (rather than a String containing the numeric value), you need an additional operation to change the value to a long:&lt;/P&gt;&lt;PRE&gt;[{
  "operation": "default",
  "spec": {
    "*": {
      "ctime": "${now():toNumber()}"
    }
  }
}, {
  "operation": "modify-overwrite-beta",
  "spec": {
    "*": {
      "ctime": "=toLong"
    }
  }
}]
&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2017 01:36:30 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2017-06-09T01:36:30Z</dc:date>
  </channel>
</rss>

