Five Stars

Extract name of JSON fields

Hi all,

 

imagine the following JSON schema:

 

 

{
   ...
   
   "structure" : {
      "time_field" : {
         "date" : {
            "name" : "Date",
            "type" : "datetime"
         }
      },
      "dimensions" : {
         "campaign_id" : {
            "access" : true,
            "name" : "Campaign ID",
            "type" : "id",
         },
         "campaign_name" : {
            "name" : "Campaign Name",
            "maxLength" : 256,
            "type" : "string"
         },
         "strategy_id" : {
            "access" : true,
            "name" : "Strategy ID",
            "type" : "id"
         },
         "strategy_name" : {
            "name" : "Strategy Name",
            "maxLength" : 256,
            "type" : "string"
         }
      },
	  
      ...
}

 

Now I need to extract the name of each dimension (campaign_id, strategy_id etc.).

 

 

This is my try via tExtractJSONFields:

 

image.pngimage.png

 

But I only get the name of the first dimension (campaign_id).

 

Could you please help?

 

 

Thanks

 

Simon

  • Data Integration
1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Extract name of JSON fields

Hi,

 

I solved this one on my own:

 

image.png

 

Thanks anyway!

4 REPLIES
Community Manager

Re: Extract name of JSON fields

Hello
You should define 4 columns to map each name. I would suggest you to define a Json metadata following the wizard under Repository->Metadata.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars

Re: Extract name of JSON fields

Hi,

 

I solved this one on my own:

 

image.png

 

Thanks anyway!

Four Stars

Re: Extract name of JSON fields

Interesting.
Five Stars

Re: Extract name of JSON fields

Right! I can now iterate over each dimension name which is really helpful facing the fact that I've to process json files with about 50 dimension elements - no separate (static) columns needed.