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

Json File generation from Redshift Table

Aravind711
New Contributor II

Hi All,

I am working on generating a JSON file from a Redshift table in the below desired format

Required Output:

{
โ€œdataโ€: [
{
โ€œclassification_codeโ€: โ€œARGENTINAโ€,
โ€œreporting_countryโ€: โ€œArgentinaโ€,
โ€œsub_regionโ€: โ€œRest of Latin Americaโ€,
โ€œterritoryโ€: โ€œLAโ€,
โ€œglobal_regionโ€: โ€œAmericasโ€,
โ€œworldwideโ€: โ€œWorldwideโ€,
โ€œpos_customer_idโ€: 8,
โ€œpos_customer_site_idโ€: 13
}
]
}

But My original Output is like the below from Snaplogic

{
โ€œclassification_codeโ€: โ€œARGENTINAโ€,
โ€œreporting_countryโ€: โ€œArgentinaโ€,
โ€œsub_regionโ€: โ€œRest of Latin Americaโ€,
โ€œterritoryโ€: โ€œLAโ€,
โ€œglobal_regionโ€: โ€œAmericasโ€,
โ€œworldwideโ€: โ€œWorldwideโ€,
โ€œpos_customer_idโ€: 8,
โ€œpos_customer_site_idโ€: 13
}

Can any one guide me to get the Required output ( I need the Data Tag to be hard coded, as it is required for the UI development )

Thanks,
Aravind

5 REPLIES 5

cstewart
Former Employee

This can be achieved simply using a Mapper snap and applying the mapping from $ to $data:
image

Does this achieve what youโ€™d like?

Aravind711
New Contributor II

image

Thanks @cstewart
I donโ€™t want the data to be repeated, i followed the steps you said and got the output as like the above screenshot.

Please suggest a way to get data like

{
โ€œdataโ€: [
{
โ€œclassification_codeโ€: โ€œARGENTINAโ€,
โ€œreporting_countryโ€: โ€œArgentinaโ€,
โ€œsub_regionโ€: โ€œRest of Latin Americaโ€,
โ€œterritoryโ€: โ€œLAโ€,
โ€œglobal_regionโ€: โ€œAmericasโ€,
โ€œworldwideโ€: โ€œWorldwideโ€,
โ€œpos_customer_idโ€: 8,
โ€œpos_customer_site_idโ€: 13
},
{
โ€œclassification_codeโ€: โ€œARGENTINAโ€,
โ€œreporting_countryโ€: โ€œArgentinaโ€,
โ€œsub_regionโ€: โ€œRest of Latin Americaโ€,
โ€œterritoryโ€: โ€œLAโ€,
โ€œglobal_regionโ€: โ€œAmericasโ€,
โ€œworldwideโ€: โ€œWorldwideโ€,
โ€œpos_customer_idโ€: 9,
โ€œpos_customer_site_idโ€: 15
},
{
โ€œclassification_codeโ€: โ€œARGENTINAโ€,
โ€œreporting_countryโ€: โ€œArgentinaโ€,
โ€œsub_regionโ€: โ€œRest of Latin Americaโ€,
โ€œterritoryโ€: โ€œLAโ€,
โ€œglobal_regionโ€: โ€œAmericasโ€,
โ€œworldwideโ€: โ€œWorldwideโ€,
โ€œpos_customer_idโ€: 10,
โ€œpos_customer_site_idโ€: 15
}
]
}

This is what, I did in JSON generator, PFB screenshot
image

Below is my pipeline
image