Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert a one line csv file to a readable format

Hi Everybody,

I am very new to Talend and I am testing data transformation from API connection. I have connected an API to Talend and have been able to extract data to a csv format. The data extracted are in one line and have the following format :

{"success":true,"records":{"Pdc":[[1527841800000,447.7861835412],[1527842700000,439.66632919867],[1527843600000,478.16631241367],[1527844500000,522.062986716],[1527845400000,602.060649143],[1527846300000,743.886690877],[1527847200000,720.484998811],[1527848100000,591.87963690933],[1527849000000,532.955004056],[1527849900000,582.24664857867],[1527850800000,587.35699449667], etc..

 

I am trying to get the following format at the end :

Operation 1 :

1527841800000 I 447.7861835412

1527842700000 I 439.66632919867

1527843600000 I 478.16631241367

etc..

 

And then Operation 2 :

Unix Time           I          Date              I      Value

1527841800000 I 01/06/2018 08h30 I 447,7861835412

1527842700000 I 01/06/2018 08h45 I 439,66632919867

1527843600000 I 01/06/2018 09h00 I 478,16631241367

 

Can someone please explain to me the right procedure to do these 2 operations in Talend. Thanking you in advance.

 

Regards,

Ashley

 

Labels (1)
  • v7.x

1 Reply
Anonymous
Not applicable
Author

Hi,

 

You need to convert that JSON file, you need to build a job like this to convert it to a delimited (csv) file.

0683p000009M1YC.png

tFileInputJSON :

- the loop JSON Query will be probably something like "$.records.Pdc[*]"

tMap :

Add a new columns using the TimeStamp value to make yourdate formatted.

tFileOutputDelimited :

Create your "xxx.csv" file as you wish

 

Pierre