Member since
12-10-2024
6
Posts
6
Kudos Received
0
Solutions
12-20-2024
02:39 AM
1 Kudo
Thank you @SAMSAL (JOLT expert), The spec you posted worked properly and I'm able to see the flat JSON as expected.
... View more
12-17-2024
05:47 AM
Also, FYI I have tried using this JOLT [
{
"operation": "shift",
"spec": {
"data": {
"getCarListing": {
"edges": {
"*": {
"node": {
"carClusterIds": {
"*": {
"element": {
"businessRelations": {
"*": {
"countries": {
"*": {
"countryCode": "[&6].[&1].CountryCode",
"@(2,code)": "[&6].[&1].BR",
"@(4,name)": "[&6].[&1].Element"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"*": {
"@": "[]"
}
}
}
}
}
] Which is giving output in the form: [ [ "US01", "CZ01", "CA01", "FR01", "DE01" ], [ "SEDAN1000", "SEDAN1000", "SEDAN1000", "TRUCK500", "TRUCK500" ], [ "US", "CZ", "CA", "FR", "DE" ], "CZ01", "SEDAN1000", "SK", [ "MX01", "JP01" ], [ "SUV2020", "COUPE3000" ], [ "MX", "JP" ] ] Which is closer to the expected output but need some formatting.
... View more
12-17-2024
04:20 AM
1 Kudo
Hi team, I'm struggling while converting nested JSON to Flat JSON using JOLT. The Nested JSON is in the below format: {
"data": {
"getCarListing": {
"edges": [
{
"node": {
"id": "1001",
"identifier": 500001,
"carClusterIds": [
{
"element": {
"name": "SEDAN1000",
"businessRelations": [
{
"countries": [
{
"countryCode": "US"
}
],
"code": "US01"
},
{
"countries": [
{
"countryCode": "CZ"
},
{
"countryCode": "SK"
}
],
"code": "CZ01"
},
{
"countries": [
{
"countryCode": "CA"
}
],
"code": "CA01"
}
]
},
"metadata": [
{
"name": "clusterId",
"value": "200011"
}
]
},
{
"element": {
"name": "SUV2020",
"businessRelations": [
{
"countries": [
{
"countryCode": "MX"
}
],
"code": "MX01"
}
]
},
"metadata": [
{
"name": "clusterId",
"value": "200012"
}
]
}
],
"parentItems": [
{
"identifier": 400050
}
]
}
},
{
"node": {
"id": "1002",
"identifier": 500002,
"carClusterIds": [
{
"element": {
"name": "TRUCK500",
"businessRelations": [
{
"countries": [
{
"countryCode": "FR"
}
],
"code": "FR01"
},
{
"countries": [
{
"countryCode": "DE"
}
],
"code": "DE01"
}
]
},
"metadata": [
{
"name": "clusterId",
"value": "200021"
}
]
},
{
"element": {
"name": "COUPE3000",
"businessRelations": [
{
"countries": [
{
"countryCode": "JP"
}
],
"code": "JP01"
}
]
},
"metadata": [
{
"name": "clusterId",
"value": "200022"
}
]
}
],
"parentItems": [
{
"identifier": 400051
}
]
}
}
]
}
}
} I want the output in this format: [
{
"Element" : "SEDAN1000",
"BR" : "US01",
"CountryCode" : "US"
},
{
"Element" : "SEDAN1000",
"BR" : "CZ01",
"CountryCode" : "CZ"
},
{
"Element" : "SEDAN1000",
"BR" : "CZ01",
"CountryCode" : "SK"
},
{
"Element" : "SEDAN1000",
"BR" : "CA01",
"CountryCode" : "CA"
},
{
"Element" : "SUV2020",
"BR" : "MX01",
"CountryCode" : "MX"
}
] Can anyone please help me with the JOLT spec that can be used to derive the nested JSON to the required Flat JSON. Thanks in Advance...
... View more
Labels:
- Labels:
-
Apache NiFi
-
Cloudera Search
12-11-2024
08:59 PM
2 Kudos
Hi Samsal, Firstly I want to thank you for taking your time in solving my query. The solution you provided worked like a magic. Secondly, yes I am new to this platform and also for JOLT, moving forward I will follow your tips and suggestions and will go through the courses which you've shared. Once again thank you for your valuable assistance. It made a significant difference. I am grateful.
... View more
12-11-2024
01:03 AM
1 Kudo
Hi @VidyaSargur , Thank you so much!
... View more
12-10-2024
09:13 PM
1 Kudo
Hi guys, I want to convert Nested JSON to Flattened JSON using JOLT transform. Nested JSON: { "data": { "getBusinessRelationListing": { "edges": [ { "node": { "id": "1964730", "name": null, "code": "CN02", "bejoCompany": true, "legacyVendorId": [], "locatonType": [ "Commercial" ], "countries": [ { "locationCountry": "CN", "countryCode": "CN", "name": "China", "parent": { "shortCode": "AMEA", "name": "Africa & Middle East & Asia" }, "region": "" } ] } }, "node": { "id": "1964732", "name": null, "code": "CZ01", "bejoCompany": true, "legacyVendorId": [], "locatonType": [ "Commercial" ], "countries": [ { "locationCountry": "CZ", "countryCode": "CZ", "name": "Czechia", "parent": { "shortCode": "EU", "name": "Europe" }, "region": "NH" }, { "locationCountry": "SK", "countryCode": "SK", "name": "Slovakia", "parent": { "shortCode": "EU", "name": "Europe" }, "region": "NH" } ] } } ] } } } I am using this JOLT Spec: [ { "operation": "shift", "spec": { "data": { "getBusinessRelationListing": { "edges": { "*": { "node": { "id": "[&2].Id", "code": "[&2].BusinessRelation", "name": "[&2].BusinessRelationDisplayName", "countries": { "*": { "locationCountry": "[&4].LocationCountry", "parent": { "name": "[&5].LocationCountryName", "shortCode": "[&5].LocationRegion" } } } } } } } } } } ] It is giving output in this format: [ { "BusinessRelation" : "CN02", "BusinessRelationDisplayName" : null, "Id" : "1964730", "LocationCountry" : "CN", "LocationCountryName" : "Africa & Middle East & Asia", "LocationRegion" : "AMEA" }, { "BusinessRelation" : "CZ01", "BusinessRelationDisplayName" : null, "Id" : "1964732", "LocationCountry" : [ "CZ", "SK" ], "LocationCountryName" : [ "Europe", "Europe" ], "LocationRegion" : [ "EU", "EU" ] } ] But I want output in the below format: [ { "BusinessRelation" : "CN02", "BusinessRelationDisplayName" : null, "Id" : "1964730", "LocationCountry" : "CN", "LocationCountryName" : "Africa & Middle East & Asia", "LocationRegion" : "AMEA" }, { "BusinessRelation" : "CZ01", "BusinessRelationDisplayName" : null, "Id" : "1964732", "LocationCountry" : "CZ" , "LocationCountryName" : "Europe", "LocationRegion" : "EU", } , { "BusinessRelation" : "CZ01", "BusinessRelationDisplayName" : null, "Id" : "1964732", "LocationCountry" : "SK" , "LocationCountryName" : "Europe", "LocationRegion" : "EU", } ] I'm new to JOLT. Please help me thank you
... View more
Labels:
- Labels:
-
Apache NiFi
-
Cloudera Search