cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Extract data from Json to CSV File

Parin
New Contributor

Hi All,

I have a JSON file and i am trying to extract specific data and copy it in a csv file.

The sample structure is given below and from this structure i want to extract only the value part from each attribute:
Like
โ€œvalueโ€: โ€œB12345678โ€
โ€œvalueโ€: โ€œTestโ€
in the CSV file.

Sample Structure:

[
{
โ€œuriโ€: โ€œentities/Uar9IVrโ€,
โ€œcreatedTimeโ€: 1579160841170,
โ€œupdatedTimeโ€: 1579694894814,
โ€œattributesโ€: {
โ€œHCOIDโ€: [
{
โ€œtypeโ€: โ€œconfiguration/entityTypes/HCO/attributes/HCOIDโ€,
โ€œovโ€: true,
โ€œvalueโ€: โ€œB12345678โ€,
โ€œuriโ€: โ€œentities/Uar9IVr/attributes/HCOID/1OAQhar5jโ€
}
],
โ€œNameโ€: [
{
โ€œtypeโ€: โ€œconfiguration/entityTypes/HCO/attributes/Nameโ€,
โ€œovโ€: true,
โ€œvalueโ€: โ€œTestโ€,
โ€œuriโ€: โ€œentities/Uar9IVr/attributes/Name/1OAQZvp6Vโ€
}
]
}
]

I am also attaching the entire structure for better understanding of the structure.

Can anyone help me with a sample snap solution for this kind of structure.

FlattenJson.txt (6.1 KB)

2 REPLIES 2

SpiroTaleski
Valued Contributor

Hi @Parin,

Please take a look at the attached sample pipeline:

SL_Community_Pipe_2020_09_30.slp (11.3 KB)

I am simply map the โ€œvalueโ€ field from each attribute and convert it to a String.

Let me know if this works for you.

Regards,
Spiro Taleski

Hi Spiro,

This works.

Thanks a lot for your help.

Regards,
Parin Shah