<?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/201114#M163129</link>
    <description>&lt;P&gt;As of NiFi 1.2.0, you can use Expression Language in JOLT specifications (&lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-3010"&gt;NIFI-3010&lt;/A&gt;). The following Chain spec adds the ctime field to your input with the current timestamp:&lt;/P&gt;&lt;PRE&gt;[{
    "operation": "default",
    "spec": {
      "*": {
        "ctime": "${now()}"
      }
    }
}]&lt;/PRE&gt;&lt;P&gt;If you want ctime you have an integer rather than a string, you can use the following EL expression:&lt;/P&gt;&lt;PRE&gt;${now():toNumber()}&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Jun 2017 20:10:24 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2017-06-07T20:10:24Z</dc:date>
    <item>
      <title>Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201113#M163128</link>
      <description>&lt;P&gt;Hi,
 we need to add a default key:value  with actual timestamp to the following json input structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;PRE&gt;&lt;EM&gt;[ {
  "host" : "DUSTSADMIN.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "28",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
}, {
  "host" : "DUSTSVMDC01.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "34",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
}, {
  "host" : "DUSTSVMDC02.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "34",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
} ]&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;
&lt;/P&gt;&lt;P&gt;needed output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;PRE&gt;&lt;EM&gt;[ { "ctime" : "Current_timestamp",
  "host" : "DUSTSADMIN.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "28",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
}, {"ctime" : "Current_timestamp",
  "host" : "DUSTSVMDC01.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "34",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
}, {"ctime" : "Current_timestamp",
  "host" : "DUSTSVMDC02.ads.xyz.de",
  "host_icons" : "menu",
  "host_state" : "UP",
  "num_services_crit" : "0",
  "num_services_ok" : "34",
  "num_services_pending" : "0",
  "num_services_unknown" : "0",
  "num_services_warn" : "0"
} ]&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 18:04:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201113#M163128</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-06-07T18:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201114#M163129</link>
      <description>&lt;P&gt;As of NiFi 1.2.0, you can use Expression Language in JOLT specifications (&lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-3010"&gt;NIFI-3010&lt;/A&gt;). The following Chain spec adds the ctime field to your input with the current timestamp:&lt;/P&gt;&lt;PRE&gt;[{
    "operation": "default",
    "spec": {
      "*": {
        "ctime": "${now()}"
      }
    }
}]&lt;/PRE&gt;&lt;P&gt;If you want ctime you have an integer rather than a string, you can use the following EL expression:&lt;/P&gt;&lt;PRE&gt;${now():toNumber()}&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2017 20:10:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201114#M163129</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-06-07T20:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201115#M163130</link>
      <description>&lt;P&gt;Hi Matt,
&lt;/P&gt;&lt;P&gt;now i got only this output  :&lt;/P&gt;&lt;OL&gt;
&lt;/OL&gt;&lt;P&gt;[{&lt;/P&gt;&lt;P&gt;"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"DUSTSADMIN.ads.xyz.de",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"28",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"DUSTSVMDC01.ads.xyz.de",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"34",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;},{"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"DUSTSVMDC02.ads.xyz.de",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"34",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;}]&lt;/P&gt;&lt;P&gt;maybe there ist something wrong with ""?
&lt;/P&gt;&lt;P&gt; regards
 Timo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 20:55:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201115#M163130</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-06-07T20:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201116#M163131</link>
      <description>&lt;P&gt;Hi Matt, &lt;/P&gt;&lt;P&gt;now i got only this output :&lt;/P&gt;&lt;P&gt;[{&lt;/P&gt;&lt;P&gt;"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"&lt;A href="http://DUSTSADMIN.ads.xyz.de"&gt;DUSTSADMIN.ads.xyz.de&lt;/A&gt;",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"28",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"&lt;A href="http://DUSTSVMDC01.ads.xyz.de"&gt;DUSTSVMDC01.ads.xyz.de&lt;/A&gt;",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"34",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;},{"ctime":"${now()}",&lt;/P&gt;&lt;P&gt;"host":"&lt;A href="http://DUSTSVMDC02.ads.xyz.de"&gt;DUSTSVMDC02.ads.xyz.de&lt;/A&gt;",&lt;/P&gt;&lt;P&gt;"host_icons":"menu",&lt;/P&gt;&lt;P&gt;"host_state":"UP",&lt;/P&gt;&lt;P&gt;"num_services_crit":"0",&lt;/P&gt;&lt;P&gt;"num_services_ok":"34",&lt;/P&gt;&lt;P&gt;"num_services_pending":"0",&lt;/P&gt;&lt;P&gt;"num_services_unknown":"0",&lt;/P&gt;&lt;P&gt;"num_services_warn":"0"&lt;/P&gt;&lt;P&gt;}]&lt;/P&gt;&lt;P&gt;maybe there ist something wrong with ""? &lt;/P&gt;&lt;P&gt;regards Timo&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 20:57:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201116#M163131</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-06-07T20:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201117#M163132</link>
      <description>&lt;P&gt;I think my problem my version is : nifi-1.1.2&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 21:33:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201117#M163132</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-06-07T21:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - How to add key:value to json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201118#M163133</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;after upgrading to nifi 1.2 all works fine !!!&lt;/P&gt;&lt;P&gt;Great work!
Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 22:15:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-How-to-add-key-value-to-json/m-p/201118#M163133</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-06-07T22:15:42Z</dc:date>
    </item>
  </channel>
</rss>

