JOLT : Grouped as array while transforming the json
See original GitHub issueHello @milosimpson ,
I was trying to convert the json from one JSON Format to another JSON Format using JOLT, But i’m not able to get the expected output. I have included the my work around below. Any help will be appreciated. Thanks.
My input.json
{
"Result": {
},
"Content": [
{
"MovieDetails": [
{
"Key": "TicketNumber",
"Value": "DF-0001"
},
{
"Key": "MovieName",
"Value": "Test"
}
]
},
{
"MovieDetails": [
{
"Key": "TicketNumber",
"Value": "DF-0002"
},
{
"Key": "MovieName",
"Value": "Test2"
}
]
},
{
"MovieDetails": [
{
"Key": "TicketNumber",
"Value": "DF-0003"
},
{
"Key": "MovieName",
"Value": "Test3"
}
]
}
]
}
My Expected Output.json
{
"Result": {
},
"Content": [
{
"MovieDetails": {
"TicketNumber": "DF-0001",
"MovieName": "Test1"
},
"MovieDetails": {
"TicketNumber": "DF-0002",
"MovieName": "Test2"
}.
"MovieDetails": {
"TicketNumber": "DF-0003",
"MovieName": "Test3"
}
}
]
}
My Actual Output.json
{
"Result": {
},
"Content": [
{
"MovieDetails": {
"TicketNumber": ["DF-0001","DF-0002","DF-0003"],
"MovieName": ["Test1","Test2","Test3"]
}
}
]
}
My Spec.json
[
{
"operation": "shift",
"spec": {
"Result": {
"*": "Result.&"
},
"Content": {
"*": {
"MovieDetails": {
"*": {
"Value": "Content.MovieDetails.@(1,Key)"
}
}
}
}
}
}
]
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top Results From Across the Web
JOLT - Transform Array of JSON objects containing nested ...
I want to transform a JSON input file into expected JSON output file: My input file: [ { "category": [ { "id": "id1",...
Read more >Transformer - Getting to know JOLT | Digibee Help Center
Understanding transformations with JOLT and how to apply them. ... the function of grouping certain content of the input JSON within the list...
Read more >jolt: JSON Transforms Simplified - chrisjordan.ca
Sometimes a property you want is an array when it has multiple values but an object when there is only one. It's annoying...
Read more >Jolt transform nested json array - Cloudera Community - 354431
How can I break and flatten nested JSON with arrays using Jolt transformations from: { "product": [ - 354431.
Read more >Nifi - Using Jolt Transform Json to prepare your Big Data
At some point everyone who works with data needs to work with json. Learn how to work with it in Apache Nifi in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Spec
Got null because of lower version. Changed version to 0.1.1 and works like a charm. You’re always a superhero @milosimpson