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

Create JSON Object Talend - tWriteJSONField Component -

Hello,
I try to use tWriteJSONField for creating a JSON Object from a CSV File but I have a particular format in input as following :
ENTPersonJointure;ENTEleveStructRattachId;ENTPersonDateNaissance;ENTPersonNomPatro;sn;givenName;personalTitle;ENTEleveBoursier;ENTEleveRegime;ENTEleveTransport;ENTEleveStatutEleve;ENTEleveMEF;ENTEleveLibelleMEF;ENTEleveNivFormation;ENTEleveFiliere;ENTEleveEnseignements;ENTEleveCodeEnseignements;structure_rattachement_fk;ENTPersonStructRattach;ENTEleveClasses
39362;173664;22-04-1994;MISIRLIU;;Gélu Gabriel;M;false;EXTERNE LIBRE;false;SCOLAIRE;31122207220;2BTS2 BIOANALYSES ET CONTRÔLE (BTS);BREVET DE TECH.SUP.EN 2 ANS : 2EME ANN.;BREVET DE TECH.SUP.EN 2 ANS : 2E ANNEE;MATHEMATIQUES;061300;;983;983$BC2-B
39362;173664;22-04-1994;MISIRLIU;;Gélu Gabriel;M;false;EXTERNE LIBRE;false;SCOLAIRE;31122207220;2BTS2 BIOANALYSES ET CONTRÔLE (BTS);BREVET DE TECH.SUP.EN 2 ANS : 2EME ANN.;BREVET DE TECH.SUP.EN 2 ANS : 2E ANNEE;ANGLAIS LV1;030201;;983;983$BC2-B
39362;173664;22-04-1994;MISIRLIU;;Gélu Gabriel;M;false;EXTERNE LIBRE;false;SCOLAIRE;31122207220;2BTS2 BIOANALYSES ET CONTRÔLE (BTS);BREVET DE TECH.SUP.EN 2 ANS : 2EME ANN.;BREVET DE TECH.SUP.EN 2 ANS : 2E ANNEE;EXPRESSION FRANCAISE;021400;;983;983$BC2-B
39362;173664;22-04-1994;MISIRLIU;;Gélu Gabriel;M;false;EXTERNE LIBRE;false;SCOLAIRE;31122207220;2BTS2 BIOANALYSES ET CONTRÔLE (BTS);BREVET DE TECH.SUP.EN 2 ANS : 2EME ANN.;BREVET DE TECH.SUP.EN 2 ANS : 2E ANNEE;BIOCHIMIE ET TECHNOLOGIES D'ANALYSE;307000;;983;983$BC2-B

I want to know if possible to use multiple Loop
Example : Please see attached image
Loop in  ENTEleveCodeEnseignements and Loop in ENTEleveEnseignements
Thank You
Mounir
Labels (4)
6 Replies
Anonymous
Not applicable
Author

Hi, multiple loops are not possible with the  tWriteJSONField.
You can do such thinks in the custom component suite tJSONDoc.
In Talend Exchange is currently an old component published. You can download the very latest versions here:
https://github.com/jlolling/talendcomp_tJSONDoc/releases
Anonymous
Not applicable
Author

Hi jlolling,
Thank you for  your reply.
I try use a tJSONDocOutput but I cannot connect  tMap component with it
Parent JSON Document is required !
Can you explain me what's the problem or give me a use case.
Thank you 🙂
Anonymous
Not applicable
Author

Please read the manual. The idea behind those components is to have a JSON document (hold by tJSONDocOpen) and work with it with all the other components. At the end you can write the result with tJSONDocSave.
https://github.com/jlolling/talendcomp_tJSONDoc/blob/master/doc/tJSONDoc.pdf
Anonymous
Not applicable
Author

Thank you :-)
I think that my problem is different as shown below
MySQL database -> tMap -> create JSON file
If you have an idea I'll take it.
Mounir
Anonymous
Not applicable
Author

Ok let assume, you want to create a json file containing all records from your query.
tJSONDocOpen_1 (choose here array or object as root) --OnSubjobOk--> tMysqlInput_1 --> tMap_1 --> tJSONDocOutput_1
tMysqlInput_1 --OnSubjobOk--> tJSONDocSave (setup here the output file)
This is a very basic approach.
You can chain tJSONDocOutput with iterate and add this way as many children as you like. There is a scenario in my documentation describing this!
SUDHAKAR2
Contributor
Contributor

Hi,

 

can anybody share the sample job for getting this output?