jolt

Check if null or empty in jolt and put another value which is present in input JSON

萝らか妹 提交于 2020-01-14 02:38:21
问题 This is my input JSON: { "AddressBilling": { "FirstName": "Some Name", "LastName": "Some Name", "Address":"some address" } "AddressShipping": { "FirstName": "", "LastName": "", "Address":"" } } I want to keep "AddressBilling" and "AddressShipping" but with different names i:e "payment_address" and "shipping_address", for which i have written a spec file for payment_address" part { "operation": "shift", "spec": { "AddressBilling": { "FirstName": "payment_address.firstname", "LastName":

Jolt Transformation - Match Values in Separate Branches - JSON

隐身守侯 提交于 2019-12-24 10:59:18
问题 I want to achieve the following JSON transformation using Jolt processor in Nifi Input JSON { "topLevel": { "secondLevelA": { "thirdLevelA": [ { "norsemen": "huntinSouth", "value": "AAA" }, { "norsemen": "huntinNorth", "value": "BBB" } ] }, "secondLevelB": { "thirdLevelB": [ { "norsemen": "huntinNorth", "oddCode": "AAA301" }, { "norsemen": "huntinNorth", "oddCode": "BBB701" }, { "norsemen": "huntinWest", "oddCode": "AAA701" } ] } } } Output JSON { "NAME": [ { "norsemen": "huntinSouth", "value

Jolt transform json - how to add default fields

给你一囗甜甜゛ 提交于 2019-12-24 10:03:54
问题 I have below input JSON : { "id": "2ef8a2ee-054f-4b43-956a-8aa4f51a41d5", "type": "VOICE", "tags": [ { "id": "some id 1", "description": "some description 1" }, { "id": "some id 2", "description": "some description 2" } ], "transcription": { "key1": "val1", "key2": "val2" } } But, output JSON should look like similarly, and add only default values: { "id": "2ef8a2ee-054f-4b43-956a-8aa4f51a41d5", "created": "2019-06-18T18:12:37", "firstName": "Khusan", "lastName": "Sharipov", "status": "OPEN"

JSON jolt shift specification for duplicate keys with different value types?

前提是你 提交于 2019-12-14 03:34:41
问题 I am trying to create a spec that will take input abc:true abc: {strings ...} and output: abc:true abc: {strings ...} I know this shouldn't require a Jolt shift, I just have to include it so that segment of my data (both abc keys) transfers over and doesn't get lost, Does anyone know what to add to a Jolt shift spec to do this ( shift 2 duplicate keys based on their value types ). 回答1: For the jolt processor, when you try to add key mappings that are already existing, the application will

JOLT transformation to flatten the entire json document with help of

只谈情不闲聊 提交于 2019-12-12 04:38:34
问题 i have below json : { "deveui": "1000", "vars": [ { "name": "CfgNo", "value":"255" }, { "name":"Status","value":{ "lampS": "unknown(0xff)", "lampL": "255" } }, { "name" : "Volt", "value": "255" }, { "name" : "gps", "value": { "lat": "12.93", "lon": "77.69" } }, {"name" : "status", "value":"up"}, {"name" : "last_status_change","value": 1503 } ] } expected output is : {[{ "deveui": "1000", "CfgNo": "255", "lampS": "unknown(0xff)", "lampL": "255", "Volt": "255", "lat": "12.93", "lon": "77.69",

How to convert complicated JSON nested array with JOLT?

被刻印的时光 ゝ 提交于 2019-12-11 18:27:29
问题 I'm trying to convert nested arrays into objects depending on the number of values in the second nested array. I can't seem to get the number of the value fields and use that as a key in my spec. Now this is my input JSON file: { "meta": { "regId": "us", "cId": "SomeProduct", "weId": 15 }, "data": { "name": "R", "details": { "headers": [ "id", "cityId", "cityName" ], "values": [ [ 1539, 17, "Moskow" ], [ 1539, 17, "Berlin" ], [ 1539, 17, "Vienna" ] ] } } } This my desired JSON Output: [ {

How can I use “not equal” condition while filtering array using JOLT specification

不想你离开。 提交于 2019-12-11 15:28:51
问题 I want to filter JSON array using JOLT transformation, where condition is negative. In the below example I want only records where URL value is not equal to Not Available. { "Photos": [ { "Id": "327703", "Caption": "TEST>> photo 1", "Url": "Not Available." }, { "Id": "327704", "Caption": "TEST>> photo 2", "Url": "http://bob.com/0001/327704/photo.jpg" }, { "Id": "327705", "Caption": "TEST>> photo 3", "Url": "http://bob.com/0001/327705/photo.jpg" } ] } 回答1: Take a look on very similar question

JSON to JSON changing array to one long string using JOLT

六眼飞鱼酱① 提交于 2019-12-11 12:56:27
问题 Lets say my json is: { "rating": { "primary": { "value": ["a","B",1] } } } What I want to achieve is: { "values": "a, B, 1" } I'm using jolt json to json code. 回答1: It is not possible with stock transformations of Jolt. You need to write your custom transformation. Check the documentation section on how to write your own transformations. 回答2: you can try the following spec [ { "operation": "modify-overwrite-beta", "spec": { "value": "=concat(@(2,rating.primary.value[0]),',',@(2,rating.primary

Check if null or empty in jolt and put another value which is present in input JSON

ぐ巨炮叔叔 提交于 2019-12-06 12:10:36
This is my input JSON: { "AddressBilling": { "FirstName": "Some Name", "LastName": "Some Name", "Address":"some address" } "AddressShipping": { "FirstName": "", "LastName": "", "Address":"" } } I want to keep "AddressBilling" and "AddressShipping" but with different names i:e "payment_address" and "shipping_address", for which i have written a spec file for payment_address" part { "operation": "shift", "spec": { "AddressBilling": { "FirstName": "payment_address.firstname", "LastName": "payment_address.lastname", "Address": "payment_address.address" }, "AddressShipping": { "FirstName":

Re-parent a JSON object using Jolt

雨燕双飞 提交于 2019-12-02 15:58:40
问题 I'd like to move a JSON object down one level using Jolt. Here's my input data : { "rating": { "primary": { "value": 3, "max": 5 }, "quality": { "value": 3, "max": 7 } } } I'm using the following spec file : [ { "operation": "shift", "spec": { "$": "NEWPARENT" } } ] I'm currently producing this output : { "NEWPARENT" : "root" } However, my goal is to produce : { "NEWPARENT": { "rating": { "primary": { "value": 3, "max": 5 }, "quality": { "value": 3, "max": 7 } } } } Can anyone help me create