Can't parse JSON correctly

One Star

Can't parse JSON correctly

I'm trying to automate some APIs. So I started from Google analytics one (I know that Talend has  a component for it, I just want to educate myself so that I can then jump to Facebook etc)

Here is my Job:

Response from GA looks like this:



I specifically want to extract 'rows' part in columns.
I can successfully make it for the first object in the array:

But when I replace "$.rows[0][1]" to "$.rows[][1]"  to iterate, I get nulls.
Any help will be appreciated.

Also. How can I save the result of my REST request into the file? tFileJSONoutput  adds some weird body object and I can't read anything from the file after that. Can I save plain text into txt?


One Star

Re: Can't parse JSON correctly

Anyone who knows JSON components well? I would really appreciate your help.

I'm using "jsonquerytool[dot]com" to validate my queries. And by using 

I'm able to extract all the first elements in rows array.

But how do I make it in Talend?
Ten Stars

Re: Can't parse JSON correctly

I've written a tutorial on working with Facebook using Talend (to get Spotify data in this case) and I cover an example of dealing with JSON. You can download the example jobs to try this out. It is reasonably complicated, but if you work through it I think you should be able to extrapolate from it to find your solution. The tutorial is here. The section on  getting data from a JSON String is titled "Extract data from JSON".
One Star

Re: Can't parse JSON correctly

rhall_2.0 Thanks a lot! Definetly checking it out.

If anyone can help with my situaltion - That would be still good. How do I deal with array of arrays in Talend?
One Star

Re: Can't parse JSON correctly

May it be connected with this issue:



Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables


Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables


Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema