One Star

Use of Talend Data Mapper

Hi, I have a usecase where I have to convert csv data to JSON, please see below the problem :
field1;field2;field3
1;;3

The expected result is :
{
"element":
}

I honestly have absolutely no idea how to answer that need, seems like something the TDM would do quite easily, but don't know how.
If you have any question about that feel free to ask.
Thank you very much for your help,
PS: I'm running a version of Talend Studio for Cloud with Data Quality 6.0.1
Simon B
5 REPLIES
One Star

Re: Use of Talend Data Mapper

Sorry => I may have omitted to say that I cannot just normalize my input data because I have multiple cases of that on my file... A complete example would be
field1;field2;field3;value1;value2;value3;value4;tagList
1;;3;"hello";"world";"!";"!";"a,b,c,d"

And the result :
{
"element": ,
"value": ,
"tags":
}
Moderator

Re: Use of Talend Data Mapper

Hi,
Do you want to use tHap to convert csv data to JSON?
Here is a component TalendHelpCenter:tWriteJSONField which transforms the incoming data into JSON fields.
Please take a look at the related scenarios to learn how to use it.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Use of Talend Data Mapper

Hi,
I knew about this component but I can't use it easily in that case because I have to split every part of my input schema (and generate a key for each line) then use one tWriteJsonField for each part of the input schema to create the different arrays, write those in a file, then join every file I created and join them and use a last tWriteJsonField to create my global Json file... It's a real pain, but apparently I had no choice... 

Hope that helps,
Simon B
Five Stars

Re: Use of Talend Data Mapper

Hi Sonam, 
Does your input structure always fixed or it has variable schema? based on that we may suggest better. 
One Star

Re: Use of Talend Data Mapper

Hi,
I don't know who Sonam is but on my side the input structure is dynamic, hence the use of a tExtractDynamicFields Smiley Happy
Thanks,