jmespath / jmespath/jmespath.site

JMESPATH (comparing aggregated nested data)

Open
#127 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
61
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Hello!

I was wondering if someone can help me find a solution to compare some nested data.

I have this dataset below, and I need to return true, for case when `type` is 'X', get `shareholder[]firstName+shareholder[]lastName` and compare with `logistic_name`, if they are the same, to give back true. I have been trying to use join, but the return is NULL.

My code is

[(shareholders != null) &&
( length(shareholders[?type == 'shareholderperson' && join(' ', [firstName, lastName]) == transaction.receiverName]) > `0`)

]

{
"id": 6731037,
"customerId": 665,
"shareholders": [ -- nested JSON --
{
"id": "1",
"type": "X,
"lastName": "one",
"firstName": "james",
},
{
"id": "2",
"type": "Z,
"lastName": "two",
"firstName": "james",
},
{
"id": "3",
"type": "Y,
"lastName": "three",
"firstName": "james",
}
],
"logistic_name": "james one", -- not nested--
}
}

Expected result will be TRUE, because there is shareholder type X where the firstName+lastName == logistic_name. ID 1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.