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

Creating JSON file with a complex structure (several levels)

Hello,
I try to create a json file from a data stream.
I created my json file ture in methadata then I build my job as follows:
it did not work, I have the impression that talend only generates a json file to a single level.
is what I can generate my file with this structure?
Can you help me?
thank you in advance.
0683p000009MBTM.png
Labels (3)
5 Replies
Anonymous
Not applicable
Author

hi amallek,
I've tried to use tWriteJson Field for some same expectations ... without success (version 5.4.2) 0683p000009MACn.png
As you've said, it's only work for basic structures.
so my workaround is to use external java libs (as com.amazonaws.util.json : I was working with json + dynamoDB).
I'm not sure (and I don't think so) that this component has been improved since that version.
regards
laurent
Anonymous
Not applicable
Author

Kzone thank you for the quick response.
I also did a search to see if talend can basically manage the json on many levels.
I found your answer that same subject https://community.talend.com/t5/Design-and-Development/Use-tFileoutputJson-to-create-complex-json-ou... .
I just wanted to be certain that this is not possible with the component talend before starting the dev with a java routine.
Anonymous
Not applicable
Author

The only solutions I use in this case are:
1. try the Data Mapper - book a learning lesson before it is very complex!
2. Using the Java API Jackson and build the document with the clear and easy to use Java API in a tJavaRow or tJavaFlex.
I am working on a component writing complex JSON documents from various subjobs. Mostly I do not have all information in one flow, so I need a way to build the whole document in steps. The mentioned Java API is at the moment the best solution. 
Anonymous
Not applicable
Author

Can someone please tell how to define this Xpath or JSON schema in TALEND ...I am trying to read one sample file with tFileInputJSON ... How to understand the JSON format and write scheme in Talend


{
"id;firstname;lastname;address;date;revenue;states": "1;Andrew;Cleveland;South Roosevelt Drive;20/01/2005;55239;XX"
},
{
"id;firstname;lastname;address;date;revenue;states": "2;Franklin;Jefferson;Carpinteria Avenue;19/05/2006;78148;NC"
},
{
"id;firstname;lastname;address;date;revenue;states": "3;Calvin;Cleveland;Corona Del Mar;28/09/2000;77912;CT"
},
{
"id;firstname;lastname;address;date;revenue;states": "4;Grover;Ford;Cleveland Ave.;27/11/2001;76036;XX"
},
Anonymous
Not applicable
Author

hi milandhore,
have a look at this post about json format & useful 'chemin de fer' - don't know english expression 0683p000009MACn.png
http://www.json.org/
easiest way to parse some simple json format is to use metadata talend helper : in metadata , right clic on File Json and follow instruction to map your data.
hope it helps
regards
laurent