nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evan Graham <lua...@gmail.com>
Subject Re: Json conversion query : Help
Date Sat, 25 May 2019 14:26:55 GMT
This should do what you need:

[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "eta": "=toLong",
      "etd": "=toLong"
    }
  },
  {
    "operation": "shift",
    "spec": {
      "eta": "&.\\$date",
      "etd": "&.\\$date",
      "*": "&"
    }
  }
]

It will convert eta and etd to longs, then the shift operation is pretty
much as Matt posted but with the extra field added.

Thanks

On Sat, May 25, 2019 at 3:48 AM Puspak <puspakdas.mca@gmail.com> wrote:

> Thanks Matt for such a quick response,
>
> This perfectly works for the above scenario .
> But my requirement is little different . I tried to implement the same in
> my
> case but failed .Could you please suggest . This is because I am relatively
> new to jolt.
>
> input :
> {
>   "eta" : "1557840900",
>   "actualdeparturetime" : "0",
>   "etd" : "1557835200",
>   "ident" : "JST529",
>   "FlightNumber" : "529",
>   "CarrierCode" : "JQ",
>   "actualarrivaltime" : "1557840900",
>   "startDate" : "1557772200"
> }
> output :
> {
>   "ident" : "JST529",
>   "eta" : {
>     "$date" : 1557840900000
>   },
>   "actualdeparturetime" : "0",
>   "etd" : {
>     "$date" : 1557835200000
>   },
>   "messageType" : "FFM",
>   "FlightNumber" : "529",
>   "CarrierCode" : "JQ",
>   "actualarrivaltime" : "0",
>   "startDate" : "1557772200"
> }
>
> that means basically the json has some other few fields as well
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message