Multi Level Json

Seven Stars

Multi Level Json

I have a JSON object with following structure (sample). As far as I can see, there are three levels...

  • Parent
    • Child
      • Grand-Child

What will be the best way to consume this and maintain a parent-child-grand-child relationship in a table? I am not able to see good documentation on tExtractJSONFields/ tFileInputJson.

 

Any pointers appreciated.

 

{
    "categories": [{
        "id": "P1",
        "name": "P1",
        "path": "P1",
        "children": [{
            "id": "P1_C1",
            "name": "P1_C1",
            "path": "P1_C1",
            "children": [{
                "id": "P1_C1_xC1",
                "name": "P1_C1_xC1",
                "path": "P1_C1_xC1"
            }, {
                "id": "P1_C1_xC2",
                "name": "P1_C1_xC2",
                "path": "P1_C1_xC2"
            }]
        }]
	}]
}	
Community Manager

Re: Multi Level Json

Hi
Using 'Xpath' model and set the xpath loop expression to:
/categories/children/children
You should be able to read parent-child-grand-child data.

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