Json path and Metadata issue

Highlighted
Seven Stars

Json path and Metadata issue

Hi

I'm trying to create Json metadata file using the option under "Metadata>File Json" in talend. The file works perfectly if i choose "Xpath". But if I choose "JSON Path", I'm not able to retrieve the first 4 columns (user_id, user_name, friend_name, friend_id), I think there is something wrong with the way I specify the "Relative or absolute path expression". Can someone shed some light on it?

 

JSON Metadata 

 

JSON.JPG

 

 

Json file

{"user": {
    "id": "9999912398",
    "name": "Kelly Clarkson",
    "friends": [
        {
            "name": "Tom Cruise",
            "id": "55555555555555",
            "likes": {"data": [
                {
                    "category": "Movie",
                    "name": "The Shawshank Redemption",
                    "id": "103636093053996",
                    "created_time": "2012-11-20T15:52:07+0000"
                },
                {
                    "category": "Community",
                    "name": "Positiveretribution",
                    "id": "471389562899413",
                    "created_time": "2012-12-16T21:13:26+0000"
                }
            ]}
        },
        {
            "name": "Tom Hanks",
            "id": "88888888888888",
            "likes": {"data": [
                {
                    "category": "Journalist",
                    "name": "Janelle Wang",
                    "id": "136009823148851",
                    "created_time": "2013-01-01T08:22:17+0000"
                },
                {
                    "category": "Tv show",
                    "name": "Now With Alex Wagner",
                    "id": "305948749433410",
                    "created_time": "2012-11-20T06:14:10+0000"
                }
            ]}
        }
    ]
}}

Thanks

MJ

Tags (1)
Highlighted
Forteen Stars

Re: Json path and Metadata issue

it is true - JSON PATH does not support parent operators

 

old, but still good article:

https://goessner.net/articles/JsonPath/

-----------
Highlighted
Seven Stars

Re: Json path and Metadata issue

Yeah, I read that article before posting and even used the examples in constructing the metadata, but i'm still failing to understand how to retrieve those columns.
Highlighted
Forteen Stars

Re: Json path and Metadata issue

just use XPath, it work well

-----------

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog