nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Villard <pierre.villard...@gmail.com>
Subject Re: JoltTransformJSON with array of jsons
Date Thu, 12 Oct 2017 10:27:54 GMT
I won't be able to provide more help (I'm always doing really simple things
with Jolt), sorry Chris.
Maybe others can chime in and give some hints.

Just as a comment Mark, in the Jolt processor configuration view, you have
an "Advanced UI" button available. If you click on it, it'll open a UI
allowing you to test your Jolt specification just as you can do on the web
page you provided. Maybe you already noticed the Advanced UI and feel it's
not providing enough features... but just wanted to say it in this thread
in case you missed it.

Pierre

2017-10-12 12:08 GMT+02:00 Chris Herssens <chris.herssens@gmail.com>:

> I tried this, but I get only one json back. Where each element has a array
> of values. I need as result an  array of json. The transformation should be
> done on each json.
>
> Op 12 okt. 2017 12:01 p.m. schreef "Mark Rachelski" <mark@acommerce.asia>:
>
> Chris,
>>
>> This does not work because your Jolt Specification is saying you are
>> looking for a top-level element called timestamp_start. Try something like
>> this:
>>
>> [
>>   {
>>     "operation" : "shift",
>>     "spec": {
>>       "*": {
>>       "timestamp_start" : "timestamp_start",
>>       "timestamp_end" : "timestamp_end",
>>       "custom_primitives" : {
>>           "*": "&" }
>>      }
>>     }
>>   }
>> ]
>>
>> to allow for the array.
>>
>> Also, I recommend you don't develop your jolt specification inside
>> NiFi... NiFi is the runtime processor.
>>
>> From a development environment just use this site:
>> http://jolt-demo.appspot.com/#inception where you can paste in your
>> starting document and specification to find a spec that does what you want.
>>   Then after the spec works, you can put it into your JoltTransformJson
>> processor.
>>
>> Mar.k
>>
>> On Thu, Oct 12, 2017 at 4:52 PM Chris Herssens <chris.herssens@gmail.com>
>> wrote:
>>
>>> Hello Pierre,
>>>
>>> I want to flatten the json content.  How to I do this ?
>>> Now  I use the chain DSL with jolt spec
>>>
>>> [
>>>   {
>>>     "operation" : "shift",
>>>     "spec": {
>>>       "timestamp_start" : "timestamp_start",
>>>       "timestamp_end" : "timestamp_end",
>>>       "custom_primitives" : {
>>>           "*": "&" }
>>>     }
>>>   }
>>> ]
>>>
>>> this doesn't work with an array of json only with a single json
>>>
>>> Regards,
>>>
>>> Chris
>>>
>>>
>>>
>>> On Thu, Oct 12, 2017 at 11:26 AM, Pierre Villard <
>>> pierre.villard.fr@gmail.com> wrote:
>>>
>>>> Hi Chris,
>>>>
>>>> Yes it is.
>>>>
>>>> For example, if I want to add a field in all JSON of my array - I can
>>>> do (with default DSL) :
>>>>
>>>> {
>>>>   "*": {
>>>>     "mynewfield":"mynewvalue"
>>>>   }
>>>> }
>>>>
>>>> I'm clearly not a Jolt expert, but others can help you if you're trying
>>>> to do something more complex.
>>>>
>>>> Pierre
>>>>
>>>>
>>>>
>>>> 2017-10-12 11:04 GMT+02:00 Chris Herssens <chris.herssens@gmail.com>:
>>>>
>>>>> Hello,
>>>>>
>>>>> Is it possible to use the JoltTransformJson processor with an array of
>>>>> jsons as input
>>>>>
>>>>> Regards,
>>>>>
>>>>> Chris
>>>>>
>>>>
>>>>
>>>

Mime
View raw message