Extract JSON data diferent levels

Four Stars

Extract JSON data diferent levels

I want to extract JSON data from a file and update a database with the data that i extracted from my file.

 

The code bellow represents my JSON data simplified :

 

 

{
  "data": {
    "uniqueIdData": "1",
    "datecreat": "2019-09-23",
    "libelle": "Septembre 2019",
    "user": "user.user@user.com",
    "date": "2019-09-23 00:00:00",
    "user": [
      {
        "uniqueId": "1",
        "expenseDate": "2019-09-23",
        "categoryName": "Car",
        "categoryType": "Car",
        "approb": [
          {
            "lvl": 1,
            "user": "user1.user@user.com",
            "date": "2019-09-26 00:00:00"
          }
        ],
        "verif_user": "user2.user@usercom",
        "verif_date": "2019-09-26 00:00:00",
        "compta_user": "user3.user@user.com",
        "compta_date": "2019-09-30 00:00:00",
        "code_projet": "PROJECTX"
      },
      {
        "uniqueId": "2",
        "expenseDate": "2019-09-24",
        "categoryName": "Fuel",
        "categoryType": "Fuel",
        "approb": [
          {
            "niv": 1,
            "user": "user2.user@user.com",
            "date": "2019-09-26 00:00:00"
          }
        ],
        "verif_user": "user2.user@user.com",
        "verif_date": "2019-09-26 00:00:00",
        "compta_user": "user3.user@user.com",
        "compta_date": "2019-10-05 00:00:00",
        "code_projet": "PROJECTY"
      }
    ]
  }
}

 

 

As you cans see the are 3 levels data =>  users => aprob.

 

Job structJob struct

 

What i have :

 

ResultResult

What i want to have :

ObjectifObjectif

Highlighted
Community Manager

Re: Extract JSON data diferent levels

Hi
Read by 'Xpath' model and set the loop xpath as "/data/user/approb", you should be able to extract all records.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Seven Stars

Re: Extract JSON data diferent levels

hello vicentef

 

if still interested i have solution.

 

just reply and i post solution.

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog