Thanks!

Appreciate the quick response!

Patrick

On 3/22/22 17:08, Christian Grün wrote:
I would write it as follows:

let $string := '{ "parties": [
   { "id": 0, "role": "CN", "name": "name1" },
   { "id": 1, "role": "SH", "name": "name2" }
] }'
let $data := json:parse($string)
return $data/json/parties[_[name = 'name1'][role = 'CN']]

Martin provided the solution for the XQuery map/array format:

let $data := json:parse($string, map { 'format': 'xquery'})
return $data?parties[exists(?*[?name = 'name1'][?role = 'CN'])]



On Tue, Mar 22, 2022 at 9:48 PM Patrick Durusau <[email protected]> wrote:
I'm anticipating incorporation of JSON sources with anonymous nodes and
if they all appear with the element name _, how do I distinguish one
from another, structurally speaking?

MarkLogic offers some specific workarounds but those are unique (I
suspect) to MarkLogic.

The MarkLogic post has an example of the problem I anticipate hitting,
especially in biblical studies.

Thanks!
Patrick

--
Patrick Durusau
[email protected]
Technical Advisory Board, OASIS (TAB)
Editor, OpenDocument Format TC (OASIS), Project Editor ISO/IEC 26300
Co-Editor, ISO/IEC 13250-1, 13250-5 (Topic Maps)

Another Word For It (blog): http://tm.durusau.net
Homepage: http://www.durusau.net
Twitter: patrickDurusau

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to