Extract name of JSON fields

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.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads