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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Tim_Ouimet
Contributor III
Contributor III

Returning access_token from tJSONDOCExtractFields

Hello Everyone!

Longtime lurker, first time poster.

Trying to extract an "access_token" from the json returned from RestAPI call.

Data looks something like this...

{

"access_token":"acccasdf23.....4234234",

"token_type":"Bearer",

"expires_in":3600

}

Tried a variety of methods to use the tJSONDocExtractFields - but nothing seems to find the elements.

I can't find the documentation for this component - though have successfully walked through the tutorials for the other within the group (tJSONDoc).

Any suggestions would be great.

Thanks for reading!

Tim

Startek, Inc
Labels (3)
5 Replies
Anonymous
Not applicable

This isn't a component provided by Talend. This one is provided by one our top component developers, a guy called @Jan Lolling​. You can find his documentation here I believe....

 

https://github.com/jlolling/talendcomp_tJSONDoc

 

I suspect that the issue here is that your loop path is incorrect. "$.access_token" is not a looping element. I suspect that you need just "$" here. Then in your json path, you will need just "access_token".

 

These are guesses, since I have not actually used this component of Jan's

 

 

jlolling
Creator III
Creator III

Hi,

the component tJSONDOCExtractFields should not be used here. This component is dedicated use cases where you want to extract json documents which you receive within a flow. You trigger the component with an iterator, thats different.

Please use tJSONDocInput instead.

There is a clear documentation:

linked within Talend Exchange and also here: https://github.com/jlolling/talendcomp_tJSONDoc/blob/master/doc/tJSONDoc.pdf

The loop path in your use case is simply "$" or "." (both work here).

The loop path addresses the object or array which contains the attributes you want to extract.

The loop path cannot contains the attribute you want to extract (you can potentially have multiple attributes to extract)

jlolling
Creator III
Creator III

I would also like to know the screenshot of the whole job (at least including where the tJSONDocOpen component can be seen).

Please keep in mind, the root component is always tJSONDocOpen which parse an input value into a json document and on this document all other components work.

Tim_Ouimet
Contributor III
Contributor III
Author

Firstly - thank you both for your response. I'm a new to talend user, getting my feet wet with which orchestration components to use when - has been my biggest learning curve.

Re-organized the job to use the main output of the RestAPI >> tJSONDocOpen >> Iterate to the tJSONDocInput and updated the components with the suggestions above. It worked exactly as I'd wanted to. Thanks again!

Startek, Inc
jlolling
Creator III
Creator III

In your use case you could use tJSONDocExtractField and connection it from the tJSONDocOpen with the normal flow (without Iterate), This way you would have the schema column from the incoming flow also in possible in the output flow.

I think, I will as soon as possible start a tutorial video session about these components.

 

BTW. Please mark your question as answered and if you like spread kudos.