title: NiFi - JOLT Spec add custom field
body: <p>I need help with a JOLT Spec, I am not experienced in JOLT expression language and to get to this point to flatten the JSON response with JOLT Spec took me quite a while.</p>
  
  <p>I need to add a variable that is NOT in the JSON response in my attempt I use "dev_id" : "TEST HELLO".</p>
  
  <p>I am using <a href="https://jolt-demo.appspot.com/#inception" rel="nofollow noreferrer">https://jolt-demo.appspot.com/#inception</a> to test the JOLT Spec where I add dev_id" : "TEST HELLO" but I cannot find dev_id in the output and no errors on syntax.</p>
  
  <p>Thanks in advance.</p>
  
  <p>My JSON response looks like this:</p>
  
  <pre><code>{
    "id": 25692584,
    "timestamp": "2018-11-19T07:23:07.022916",
    "notification": "$device-add",
    "parameters": {
      "id": "aa190000-3143-0000-2020",
      "isBlocked": false,
      "name": "aa190000-3143-0000-2020",
      "status": "Online",
      "type": "DOOR",
      "time": "2000-01-01T02:00:39.000000",
      "secure": true,
      "mode": "idle",
      "gps.lat": 24.675699,
      "gps.long": 46.663898,
      "entries": "959,reboot 0x0001",
      "data": {
        "desc": "Undescribed",
        "imei": "861107036",
        "simid": "89564700000"
      },
      "network": {
        "id": 11,
        "name": "TEST",
        "description": null
      },
      "deviceClass": {
        "id": 12,
        "name": "CGM_IOT",
        "version": "2.0",
        "isPermanent": false,
        "offlineTimeout": 60,
        "data": null,
        "equipment": []
      }
    }
  }
  </code></pre>
  
  <p>I then use the following JOLT Spec:</p>
  
  <pre><code>[
    {
      "operation": "shift",
      "spec": {
        "*": "&amp;",
        "parameters": {
          "*": "parameters-&amp;",
          "data": {
            "*": "data-&amp;"
          },
          "network": {
            "*": "network-&amp;"
          },
          "deviceClass": {
            "*": "deviceClass-&amp;"
          }
        }
      }
      }
  ]
  </code></pre>
  
  <p>And receive the following output:</p>
  
  <pre><code>{
    "id" : 25692584,
    "timestamp" : "2018-11-19T07:23:07.022916",
    "notification" : "$device-add",
    "parameters-id" : "aa190000-3143-0000-2020",
    "parameters-isBlocked" : false,
    "parameters-name" : "aa190000-3143-0000-2020",
    "parameters-status" : "Online",
    "parameters-type" : "DOOR",
    "parameters-time" : "2000-01-01T02:00:39.000000",
    "parameters-secure" : true,
    "parameters-mode" : "idle",
    "parameters-gps.lat" : 24.675699,
    "parameters-gps.long" : 46.663898,
    "parameters-entries" : "959,reboot 0x0001",
    "data-desc" : "Undescribed",
    "data-imei" : "861107036",
    "data-simid" : "89564700000",
    "network-id" : 11,
    "network-name" : "TEST",
    "network-description" : null,
    "deviceClass-id" : 12,
    "deviceClass-name" : "CGM_IOT",
    "deviceClass-version" : "2.0",
    "deviceClass-isPermanent" : false,
    "deviceClass-offlineTimeout" : 60,
    "deviceClass-data" : null,
    "deviceClass-equipment" : [ ]
  }    
  </code></pre>
  
  <p>What I have tried in the JOLT Spec:</p>
  
  <pre><code>[
    {
      "operation": "shift",
      "spec": {
        "*": "&amp;",
        "dev_id": "TEST HELLO",
        "parameters": {
          "*": "parameters-&amp;",
          "data": {
            "*": "data-&amp;"
          },
          "network": {
            "*": "network-&amp;"
          },
          "deviceClass": {
            "*": "deviceClass-&amp;"
          }
        }
      }
      }
  ]
  </code></pre>
  
  <p>My expected output: </p>
  
  <pre><code>{
    "id" : 25692584,
    "timestamp" : "2018-11-19T07:23:07.022916",
    "notification" : "$device-add",
    "dev_id" : "TEST HELLO",
    "parameters-id" : "aa190000-3143-0000-2020",
    "parameters-isBlocked" : false,
    "parameters-name" : "aa190000-3143-0000-2020",
    "parameters-status" : "Online",
    "parameters-type" : "DOOR",
    "parameters-time" : "2000-01-01T02:00:39.000000",
    "parameters-secure" : true,
    "parameters-mode" : "idle",
    "parameters-gps.lat" : 24.675699,
    "parameters-gps.long" : 46.663898,
    "parameters-entries" : "959,reboot 0x0001",
    "data-desc" : "Undescribed",
    "data-imei" : "861107036",
    "data-simid" : "89564700000",
    "network-id" : 11,
    "network-name" : "TEST",
    "network-description" : null,
    "deviceClass-id" : 12,
    "deviceClass-name" : "CGM_IOT",
    "deviceClass-version" : "2.0",
    "deviceClass-isPermanent" : false,
    "deviceClass-offlineTimeout" : 60,
    "deviceClass-data" : null,
    "deviceClass-equipment" : [ ]
  } 
  </code></pre>