<?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 can I adjust my JOLT transformation to force an output property to be a string in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225626#M84652</link>
    <description>&lt;P&gt;Try the following chain spec (it uses Modify-overwrite instead of Shift):&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "effectiveStart": "=toString",
      "effectiveEnd": "=toString"
    }
  }
]&lt;/PRE&gt;&lt;P&gt;That will preserve all other fields, but change the values of effectiveStart/End to strings&lt;/P&gt;</description>
    <pubDate>Tue, 30 Oct 2018 22:45:33 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2018-10-30T22:45:33Z</dc:date>
    <item>
      <title>How can I adjust my JOLT transformation to force an output property to be a string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225624#M84650</link>
      <description>&lt;P&gt;The following code is the current JOLT transformation that I am using in a NIFI JoltTransformJSON processor:&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "shift",
    "spec": {
      "textNOTAM": {
        "NOTAM": {
          // simple match.  Put the value '4' in the output under the "Rating" field
          "id": "&amp;amp;0",
          "number": "&amp;amp;0",
          "year": "&amp;amp;0",
          "type": "&amp;amp;0",
          "issued": "&amp;amp;0",
          "affectedFIR": "&amp;amp;0",
          "minimumFL": "&amp;amp;0",
          "maximumFL": "&amp;amp;0",
          "radius": "&amp;amp;0",
          "location": "&amp;amp;0",
          "effectiveStart": "&amp;amp;0",
          "effectiveEnd": "&amp;amp;0",
          "schedule": "&amp;amp;0",
          "text": "&amp;amp;0"
        }
      }
    }
}]
&lt;/PRE&gt;&lt;P&gt;A typical flow file coming out of my JOLT transformation looks like this:&lt;/P&gt;&lt;PRE&gt;{"id":"NOTAM_1_51227850","number":376,"year":2018,"type":"N","issued":"2018-10-30T12:29:00.000Z","affectedFIR":"LIMM","minimumFL":"000","maximumFL":999,"radius":5,"location":"LIPA","effectiveStart":201810301229,"effectiveEnd":201811032359,"text":"NON-STANDARD BARRIER CONFIGURATION. BARRIER 2 (BAK-12) UNSERVICEABLE"}&lt;/PRE&gt;&lt;P&gt;The problem I am having is with the effectiveStart and effectiveEnd fields. I need the value to be a string, not a number. How can I adjust the JOLT transformation above to ensure that it is a string?&lt;/P&gt;&lt;P&gt;The JSON that comes out of this processor, I then inject into MONGO using a PutMongo processor.&lt;/P&gt;&lt;P&gt; Because of this input format problem, with effectiveStart and effectiveEnd, they are coming out of mongo as follows:&lt;/P&gt;&lt;PRE&gt;{ "_id" : ObjectId("5bc8b2808aad6206ababaa4b"), "id" : "NOTAM_1_51105982", "number" : 7, "year" : 2018, "type" : "N", "issued" : "2018-10-16T00:13:00.000Z", "affectedFIR" : "ZBW", "minimumFL" : "000", "maximumFL" : 999, "radius" : 5, "location" : "OXC", "effectiveStart" : NumberLong("201810160013"), "effectiveEnd" : "201810312359EST", "text" : "SVC AUTOMATED WX BCST SYSTEM PRECIPITATION OUT OF SERVICE" }&lt;/PRE&gt;&lt;P&gt;Notice that the effectiveStart is a NumberLong. How can I adjust the JOLT transform to ensure that the effectiveStart and effectiveEnd are seen as strings when the JSON flow file is sent to PutMongo?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 19:59:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225624#M84650</guid>
      <dc:creator>dave_sargrad</dc:creator>
      <dc:date>2018-10-30T19:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I adjust my JOLT transformation to force an output property to be a string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225625#M84651</link>
      <description>&lt;P&gt;Do you need the numbers as-is into strings, or a formatted timestamp string, or something else?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 22:43:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225625#M84651</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-10-30T22:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I adjust my JOLT transformation to force an output property to be a string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225626#M84652</link>
      <description>&lt;P&gt;Try the following chain spec (it uses Modify-overwrite instead of Shift):&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "effectiveStart": "=toString",
      "effectiveEnd": "=toString"
    }
  }
]&lt;/PRE&gt;&lt;P&gt;That will preserve all other fields, but change the values of effectiveStart/End to strings&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 22:45:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225626#M84652</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-10-30T22:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I adjust my JOLT transformation to force an output property to be a string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225627#M84653</link>
      <description>&lt;P&gt;Thank you &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; for the key operation that i was missing. Keep in mind, I still need the shift operation since I am reducing a more complex JSON as part of the shift&lt;/P&gt;&lt;P&gt;So the entire spec contains two operations as follows.. &lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "shift",
    "spec": {
      "textNOTAM": {
        "NOTAM": {
          
          "id": "&amp;amp;0",
          "number": "&amp;amp;0",
          "year": "&amp;amp;0",
          "type": "&amp;amp;0",
          "issued": "&amp;amp;0",
          "affectedFIR": "&amp;amp;0",
          "minimumFL": "&amp;amp;0",
          "maximumFL": "&amp;amp;0",
          "radius": "&amp;amp;0",
          "location": "&amp;amp;0",
          "effectiveStart": "&amp;amp;0",
          "effectiveEnd": "&amp;amp;0",
          "schedule": "&amp;amp;0",
          "text": "&amp;amp;0"
        }
      }
    }
},
{
    "operation": "modify-overwrite-beta",
    "spec": {
      "effectiveStart": "=toString",
      "effectiveEnd": "=toString"
    }
  }
]
&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 22:28:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-adjust-my-JOLT-transformation-to-force-an-output/m-p/225627#M84653</guid>
      <dc:creator>dave_sargrad</dc:creator>
      <dc:date>2018-10-31T22:28:55Z</dc:date>
    </item>
  </channel>
</rss>

