Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Catch up on the newest Qlik features and improvements: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
JSchultzWheda
Contributor
Contributor

Using Both tJavaRow and tExtractJsonFields on HTTP Response Data

I'm pretty new to Talend Studio and building pipelines with it and I've got a confusing situation.

I need to pull the three main fields from an HTTP Response (headers, status, body) and store them in a database (for audit purposes).  However, I also need to dive into the body of the response (which will be Json), find a specific tag (a metadata tag), and capture two fields from this metadata tag.  With both outputs, I then need to combine it into one and save an audit record to a database.

I know how to work with either the tJavaRow (to get the header, status, and body fields) and the tExtractJsonFields (to get the metadata).  What I'm having an issue with is combining these two outputs back together and then saving it to the database.  Every route to do this seems either overly complicated (trying to do some Java package imports and writing even more custom Java code) or is just flat-out not allowed by Talend Studio because you can't tUnion or even tMap from the 'same source' back together.

Is there a simpler way to do what I'm wanting?  For example, my HTTP response might be:

{"headers": "someheaders", "status": 200, "body": { "meta": { "field1": "value1", "field2": "value2"}}}

And I need to capture it into my database like this

headers -> someheaders

status -> 200

field1 -> value1

field2 -> value2

Labels (2)
1 Reply
Gjeremy
Employee
Employee

Hello,

Why not storing the headers and status in global variable, then parse the body json and then just use a tJavaRow to add the headers and status from the globalvar and the json extract together.

 

Best regards,

Jérémy