Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
SanyaBLR
Contributor
Contributor

How to get rid of an excessive block of JSON?

Hi,

can anybody help me to get rid of an excessive beginner block of JSON?

This is my flow, where I get with API data of each order and store it like JSON file.

0695b00000OB6B8AAL.png

This is the result of what I have:

0695b00000OB6CBAA1.png

I don't need this beginning block "string". I try to use various methods, maybe you can help me?

Or just show me can use this component or another such as tWriteJSONfields. All I need is to store files in the correct way without excessive block.

Thank you.

Labels (5)
3 Replies
Anonymous
Not applicable

I think a better way to think about this is "what do I want to keep?". We can't tell you how to get rid of a block of JSON easily without seeing the whole document and knowing what you want to keep. If you can show us a complete document (obviously removing any private data) and let us know what you need to keep, I'm sure we can give you some options.

SanyaBLR
Contributor
Contributor
Author

hi, @Richard Hall​

 

all I need is to get and save JSON file through API as is.

 

I'm able to get the correct file using Postman. I send a GET query like:

GET /admin/api/2022-01/orders/{order_id}.json

 

I attached the file which I would like to get. (All private data has been replaced).

 

But I need to automate this process with Talend, but the output file has structure like in the previous message. All I want is to get rid of "string", like in the screenshot below:

0695b00000OBFNDAA5.pngThe file should begin with the "order" block, not "string".

 

Thank for your help.

Anonymous
Not applicable

OK, for some reason your API is returning a JSON array of orders with only one order in it.....according to what you have said. This is relatively easy to work with. You simply need to use a tExtractJSONFields component after your tRestClient component and use the following "Loop JSON Query"....

 

"[*]"

 

.....and the following JSON Path to extract just the Order(s) within the array.....

 

"string"

 

I have tested this and it works.