Extract name of JSON fields

Highlighted
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


Accepted Solutions
Five Stars

Re: Extract name of JSON fields

Hi,

 

I solved this one on my own:

 

image.png

 

Thanks anyway!


All 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.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads