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: 
Anonymous
Not applicable

How to output JSON records in multiple rows

Hi Experts,

I have generated a JSON output file using Talend. However, my problem is that all my records are outputted in 1 row in the JSON file. Below is the sample output:

My desired output is to have all JSON record separated by newline in the output file:

Thanks in advance for the feedback and help.
Labels (3)
7 Replies
Anonymous
Not applicable
Author

replace "}," with "},\n"
Anonymous
Not applicable
Author

replace "}," with "},\n"

Thanks for the feedback.
But how do I process JSON file as plain text? When I try to process it, it is always filtered by column. For example, when I try to process the string, records are usually separated by field (field1, field2, field3) and not the whole string ( {"field1":"value1_1","field2":"value2_1","field3":"value3_1"},{"field1":"value1_2","field2":"value2_2","field3":"value3_2"},{"field1":"value1_3","field2":"value2_3","field3":"value3_3"})
Anonymous
Not applicable
Author

After you wrote the json file, open it raw (tfileinputraw), read as string, searchn´replace in a tjavarowcomponent, write raw.
Take care about the Encoding
Anonymous
Not applicable
Author

Oh dear... string manipulation to transform JSON? Seriously?
Why do you need to pretty print the output this way. For a technical usage of the file this does not makes sense. For the human read you can use tools which formats the file in a human readable way.
I would never ever manipulating the json content which such error prone methods.
Anonymous
Not applicable
Author

We really need some sort of +1 or Like mechanism in here jlolling 🙂
I have to say I agree with Jan, but maybe you can explain why you need the JSON in that format ctufindgood? It does seem like a weird requirement, but I have also had many weird requirements from clients 🙂
Anonymous
Not applicable
Author

@jolli: hopy you didn´t called me a dear  ...
Anonymous
Not applicable
Author

Hi jlolling and rhall2.0,
Yes, it is for a technical usage. It needs to accept data in the format of JSON, but the separator (",") actually needs to be replaced by newline character (\n).
Many Thanks.