Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am trying to parse below json, which has multple nested lists (input & output), how do I parse it ?
{
"status":"current",
"entry":[{
"item":{
"name":"Task1",
"identifier":"T00001",
"input":[{
"type":{
"text":"InputTask1-1"
},
"valueString":"Weekly"
},
{
"type":{
"text":"InputTask1-2"
},
"valueString":"Daily"
}
],
"output":[{
"type":{
"text":"OutputTask1-1"
},
"valueString":"Daily"
},
{
"type":{
"text":"OutputTask1-2"
},
"valueString":"Weekly"
}
]
}
},
{
"item":{
"name":"Task2",
"identifier":"T00002",
"input":[{
"type":{
"text":"InputTask2-1"
},
"valueString":"Weekly"
},
{
"type":{
"text":"InputTask2-2"
},
"valueString":"Daily"
}
],
"output":[{
"type":{
"text":"OutputTask2-1"
},
"valueString":"Daily"
},
{
"type":{
"text":"OutputTask2-2"
},
"valueString":"Weekly"
}
]
}
}
]
}
Looking for delimited output file like this:
"TaskName"|"TaskId"|"InputName"|"InputValue"|"OutputName"|"OutputValue"
Task1|T00001|InputTask1-1|Weekly|outputDummyText|outputDummyValue
Task1|T00001|InputTask1-2|Daily|outputDummyText|outputDummyValue
Task1|T00001|inputDummyText|inputDummyValue|OutputTask1-1|Daily
Task1|T00001|inputDummyText|inputDummyValue|OutputTask1-2|Weekly
Task2|T00002|InputTask2-1|Weekly|outputDummyText|outputDummyValue
Task2|T00002|InputTask2-2|Daily|outputDummyText|outputDummyValue
Task2|T00002|inputDummyText|inputDummyValue|OutputTask2-1|Daily
Task2|T00002|inputDummyText|inputDummyValue|OutputTask2-2|Weekly
HI,
I have used your input JSON file as reference and I got the following output using the job in below format. You may have to make minor changes based on your specific use case but it will give you a break through.
Coming to the component details, please refer the screen shot below for each component and schema details.
Hope you got the path to resolve your use case. Please mark the topic as resolved if you are happy with the details. Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
HI,
I have used your input JSON file as reference and I got the following output using the job in below format. You may have to make minor changes based on your specific use case but it will give you a break through.
Coming to the component details, please refer the screen shot below for each component and schema details.
Hope you got the path to resolve your use case. Please mark the topic as resolved if you are happy with the details. Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hi Nikhil,
So I was able to parse a multi-nested JSON but have 2 questions:
1. When parsing the data points in the second JSON, I'm getting double quotes and square brackets in the results (screenshot: Result.png). How do I parse these out in tExtractJSONFields? (I can use tReplace as a workaround but was wondering if this could be done in tExtractJSONFields)
2. If you check out the JSON.png, you'll see there are two instances of minQty and maxQty, one under filterType: "LOT_SIZE" and another under filterType: "MARKET_LOT_SIZE". Is there a way I can specify in tExtractJSONFields which one to select? For example, if I want to say pick the first one but ignore the second, how do I do that? Or if I want to say parse "LOT_SIZE" and ignore "MARKET_LOT_SIZE", how do I do that?
Since your query is for a different use case, I would recommend to create a new post so that we will not dilute the original post context. While creating the post, please also add 5 sample input records, expected JSON output and current output you are getting.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved