<?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: how do Add attributes to a json file in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351274#M236202</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;You can use JoltJsonTransform Processor for that. So lets assume we have the following input:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "_id": "5d55246b9ac36012c14b5e7c",
    "gtin": "4009602235038",
    "articleNumber": "59218-376",
    "styleGroupId": "59218",
    "colorGroupId": "376",
    "brand": {
      "_id": "57f75950a56ab89d1973ee36"
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add JoltTranformJson processor and set the Jolt Specification property to the following, notice this property allows you to use Expression Language therefore you can reference attributes in the flowfile:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "modify-default-beta", //for modify-overwrite-beta 
    "spec": { 
      "*": {
        "target.sku": "${target.sku}"
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will produce the following Json:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "_id" : "5d55246b9ac36012c14b5e7c",
  "gtin" : "4009602235038",
  "articleNumber" : "59218-376",
  "styleGroupId" : "59218",
  "colorGroupId" : "376",
  "brand" : {
    "_id" : "57f75950a56ab89d1973ee36"
  },
  "target.sku" : "someValue"
} ]&lt;/LI-CODE&gt;&lt;P&gt;If you find this helpful please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 21:17:35 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2022-08-31T21:17:35Z</dc:date>
    <item>
      <title>how do Add attributes to a json file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351268#M236200</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;I would like to add an attribute to a json file. The json file is a result of an api query with the Invoke HTTP procesor. As a next step I want to add an attribute to the json file to the existing fields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarioFRS_0-1661975374654.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/35420iB18D848AB51CEA53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MarioFRS_0-1661975374654.png" alt="MarioFRS_0-1661975374654.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I expected this:&lt;/P&gt;&lt;P&gt;[ {&lt;BR /&gt;"_id" : "5d55246b9ac36012c14b5e7c",&lt;BR /&gt;"gtin" : "4009602235038",&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;"target.sku : "59218_5_champagner", &amp;lt;- added attribute value&lt;/FONT&gt;&lt;BR /&gt;"articleNumber" : "59218-376",&lt;BR /&gt;"styleGroupId" : "59218",&lt;BR /&gt;"colorGroupId" : "376",&lt;BR /&gt;"brand" : {&lt;BR /&gt;"_id" : "57f75950a56ab89d1973ee36"&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 19:55:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351268#M236200</guid>
      <dc:creator>MarioFRS</dc:creator>
      <dc:date>2022-08-31T19:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do Add attributes to a json file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351274#M236202</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;You can use JoltJsonTransform Processor for that. So lets assume we have the following input:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "_id": "5d55246b9ac36012c14b5e7c",
    "gtin": "4009602235038",
    "articleNumber": "59218-376",
    "styleGroupId": "59218",
    "colorGroupId": "376",
    "brand": {
      "_id": "57f75950a56ab89d1973ee36"
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add JoltTranformJson processor and set the Jolt Specification property to the following, notice this property allows you to use Expression Language therefore you can reference attributes in the flowfile:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "modify-default-beta", //for modify-overwrite-beta 
    "spec": { 
      "*": {
        "target.sku": "${target.sku}"
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will produce the following Json:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "_id" : "5d55246b9ac36012c14b5e7c",
  "gtin" : "4009602235038",
  "articleNumber" : "59218-376",
  "styleGroupId" : "59218",
  "colorGroupId" : "376",
  "brand" : {
    "_id" : "57f75950a56ab89d1973ee36"
  },
  "target.sku" : "someValue"
} ]&lt;/LI-CODE&gt;&lt;P&gt;If you find this helpful please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 21:17:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351274#M236202</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-08-31T21:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: how do Add attributes to a json file</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351473#M236273</link>
      <description>&lt;P&gt;Thanks Mr&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;for the insight. I learned from it because i was even thinking of telling him to use EvaluateJsonPath &amp;amp; ReplaceText processor.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 20:08:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-do-Add-attributes-to-a-json-file/m-p/351473#M236273</guid>
      <dc:creator>rafy</dc:creator>
      <dc:date>2022-09-04T20:08:14Z</dc:date>
    </item>
  </channel>
</rss>

