Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

JSON.Search

Performs a JMESPath query.

Component Version macOS Windows Linux Server iOS SDK
JSON 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "JSON.Search"; json; path )   More

Parameters

Parameter Description Example
json A JSON text or reference. "{\"people\":[{\"first\":\"Christian\",\"last\":\"Schmitz\",\"city\":\"Nickenich\"}]}"
path The path to query.

Result

Returns JSON or error.

Description

Performs a JMESPath query.
The jmespath extension implements JMESPath. JMESPath is a query language for transforming JSON documents into other JSON documents. It's supported in both the AWS and Azure CLI and has libraries available in a number of languages.

To learn more about JMESPath, please check this website:
https://jmespath.org

See also JSON.Query for queries with JSONPath expressions.

Examples

Try it:

MBS( "JSON.Search"; "{ \"locations\": [
  {\"name\": \"Seattle\", \"state\": \"WA\"},
  {\"name\": \"New York\", \"state\": \"NY\"},
  {\"name\": \"Bellevue\", \"state\": \"WA\"},
  {\"name\": \"Olympia\", \"state\": \"WA\"}
]}"; "locations[?state == 'WA'].name | sort(@) | {WashingtonCities: join(', ', @)}")

Example result:
{ "WashingtonCities": "Bellevue, Olympia, Seattle" }

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 17th September 2023, last changed 13th October 2023


JSON.ReplaceItemInObject - JSON.SetPathItem

💬 Ask a question or report a problem