Search code examples
counttalendtmap

Get Count from tRest in Talend


I am using a tRest component to get data from a web service. The tLogRow indicates a count value that I would like to get, but don't know how.

{"result":[my data blabla multiple fields],"count":22}

How can I get the count value ?

I tried a tExtractJSONFields and a tMap, but to no avail tMap

tExtractJSONFields tExtractJSONFields

Thank you in advance, I appreciate the help


Solution

  • the problem comes from your tExtractJSONFields component the JSON path should point to the previous node you're trying to access (you want the count so in this case is the root of the JSON) and you haven't set the JSON query to retreive the data.

    Given the data you've given in your question

    {"result":[my data blabla multiple fields],"count":22}
    

    The configuration should be like this :

    enter image description here