Need component to parse JSON String

One Star

Need component to parse JSON String

Hi ,

Please let me know is there any out of box component is there which I can use to parse JSON (Except tJSONInput) .

Regards,
Biswajit
Moderator

Re: Need component to parse JSON String

Hi,
For talend open studio products, there are three JSON components. tFileInputJSON, tWriteJSONField and tFileOutputJSON
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Need component to parse JSON String

Hi Sabrina,
Thanks for the reply.
tWriteJSonField is used for forming a JSON.
Three JSON components. tFileInputJSON and tFileOutputJSON components are used for reading and parsing JSOn from a file. But my requirements is that I am passing JSON String and I need to parse that.

So in that case what component I can use ?

Regards,
Biswajit
Seventeen Stars

Re: Need component to parse JSON String

Take a look to the component from Talend Exchange tJsonNormalize. It traverse through the entire JSON object and renders all keys and values.
Additional the path to every key-value pair is provided.
Moderator

Re: Need component to parse JSON String

Hi Biswajit
So far, we don't have such component that passing JSON String and parsing it directly. Certainly, you can have a look at the talend exchange portal, as jlolling said. In talend, we support the custom component:Installing a custom component.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Need component to parse JSON String

Thank You jlolling.  tJsonNormalize turned out to be quite useful as a workaround for "Force mapping as array in Rest json request" issue. 
- harsha
One Star

Re: Need component to parse JSON String

Thanks you jlolling for this.  Its a huge timesaver.  The only thing I could suggest is a reject flow.

Re: Need component to parse JSON String

@jlolling
what if there is no key-value pair but just the key i want to retrieve?
this is the JSON i have and i wan't to retrieve the value that comes after 'velocityStatEntries', for example: 10516, 10244, 10182 etc.
{
"sprints": ,
"velocityStatEntries": {
"10516": {
"estimated": {
"value": 10.0,
"text": "10.0"
},
"completed": {
"value": 7.5,
"text": "7.5"
}
},
"10244": {
"estimated": {
"value": 15.5,
"text": "15.5"
},
"completed": {
"value": 7.5,
"text": "7.5"
}
},
"10182": {
"estimated": {
"value": 12.0,
"text": "12.0"
},
"completed": {
"value": 10.0,
"text": "10.0"
}
},
"10391": {
"estimated": {
"value": 16.0,
"text": "16.0"
},
"completed": {
"value": 3.0,
"text": "3.0"
}
},
"10183": {
"estimated": {
"value": 12.0,
"text": "12.0"
},
"completed": {
"value": 7.0,
"text": "7.0"
}
},
"10123": {
"estimated": {
"value": 11.5,
"text": "11.5"
},
"completed": {
"value": 5.5,
"text": "5.5"
}
},
"10447": {
"estimated": {
"value": 7.0,
"text": "7.0"
},
"completed": {
"value": 3.0,
"text": "3.0"
}
}
}
}

when i use the tJSONnormalize i get this: 
sprints,0
sprints,0
sprints,0
sprints,0
sprints,0
sprints,1
sprints,1
sprints,1
sprints,1
sprints,1
sprints,2
sprints,2
sprints,2
sprints,2
sprints,2
sprints,3
sprints,3
sprints,3
sprints,3
sprints,3
sprints,4
sprints,4
sprints,4
sprints,4
sprints,4
sprints,5
sprints,5
sprints,5
sprints,5
sprints,5
sprints,6
sprints,6
sprints,6
sprints,6
sprints,6
velocityStatEntries,10516,estimated
velocityStatEntries,10516,estimated
velocityStatEntries,10516,completed
velocityStatEntries,10516,completed
velocityStatEntries,10244,estimated
velocityStatEntries,10244,estimated
velocityStatEntries,10244,completed
velocityStatEntries,10244,completed
velocityStatEntries,10182,estimated
velocityStatEntries,10182,estimated
velocityStatEntries,10182,completed
velocityStatEntries,10182,completed
velocityStatEntries,10391,estimated
velocityStatEntries,10391,estimated
velocityStatEntries,10391,completed
velocityStatEntries,10391,completed
velocityStatEntries,10183,estimated
velocityStatEntries,10183,estimated
velocityStatEntries,10183,completed
velocityStatEntries,10183,completed
velocityStatEntries,10123,estimated
velocityStatEntries,10123,estimated
velocityStatEntries,10123,completed
velocityStatEntries,10123,completed
velocityStatEntries,10447,estimated
velocityStatEntries,10447,estimated
velocityStatEntries,10447,completed
velocityStatEntries,10447,completed

so i want the second value in the last part of the code, how do i extract that number WITH the value for 'estimated' and 'completed'.
because eventually i need the following output:
sprint_id | sprint_name | estimated | completed
with tExtractJSONFields i can get the sprint_id | sprint_name in one job and estimated | completed in another job because it cannot be done in 1 job.. but to join the data in the database i also need the sprint_id for the values estimated and completed