Hi everyone.

This might be a easy question, I have been fighting with it for a couple hours. I have a JSON array that is sent to a splitter to process each JSON object.

HERE'S SAMPLE JSON BODY:

{
    "id": "2b144adc-1af4-1446-e22a-58b367d22272",
    "module_name": "Accounts",
    "name_value_list": {
        "name": {
            "name": "name",
            "value": "Tri-State Medical Corp"
        },
        "account_type": {
            "name": "account_type",
            "value": "Customer"
        },
        "industry": {
            "name": "industry",
            "value": "Environmental"
        },
        "annual_revenue": {
            "name": "annual_revenue",
            "value": ""
        },
        "rating": {
            "name": "rating",
            "value": ""
        }

    }
}

Here's my route, I can't seem to find the right syntax to get jsonpath() to evaluate like XPATH. It wont run because the JSON path string isn't happy.

from("file:///opt/talend/esb/talend-esb-csv-to-xml/data1?noop=true&autoCreate=true&flatten=false&fileName=accounts.json)
                .split()
                .jsonpath("$.entry_list[*]")

                .choice()

                   .when().jsonpath( *"**$.name_value_list.account_type.value = 'Customer'*"   )
                      .log("CUSTOMER \n ${body}")

                   .when().jsonpath(  "*$.name_value_list.account_type.value = 'Vendor'*"  )
                      .log("VENDOR\n ${body}")

Reply via email to