// Select a single item
people[1].firstName
// Select a slice of an array
people[0:5]
// Select all the first names
people[*].firstName
// Select all first names based on search term
people[?state=='VA'].firstName
// Count how many people are over 35
length(people[?age>`35`])
// Select only the name and age of people over 35
people[?age>`35`].{name: name, age: age}
// Join expressions together to sort and join elements into a string
people[?state == 'WA'].name | sort(@) | join(', ', @)
JSON是一种轻量级的数据交换格式,广泛用于在web上交换数据和在数据库中存储数据。许多应用程序将JSON与XML和HTML一起使用。XQuery 3.1扩展了XQuery以支持JSON和XML,向数据模型添加了映射和数组,并使用语言中的新表达式和[XQuery and XPath functions and Operators 3.1]中的新函数来支持它们。