JSON.Search
-----------

Performs a JMESPath query.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JSON](component_JSON.md) | [13.5](newinversion135.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JSON.Search"; JSON; Path ) 

**MBS**( **"JSON.Search";** /\* Performs a JMESPath query. \*/  
**$JSON**; /\* A JSON text or reference.e.g. "{\\"people\\":\[{\\"first\\":\\"Christian\\",\\"last\\":\\"Schmitz\\",\\"city\\":\\"Nickenich\\"}\]}" \*/   
**$Path**) /\* The path to query. \*/ 

### 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](JSONQuery.md) 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(', ', @)}")  
<small>  
Example result:   
{ "WashingtonCities" : "Bellevue, Olympia, Seattle" } </small>### See also

- [JSON.Import](JSONImport.md)
- [JSON.Query](JSONQuery.md)
- [JSON.ToCSV](JSONToCSV.md)

### Release notes

- **Version 14.0**
    - Fixed an endless loop in [JSON.Search](https://www.mbsplugins.eu/JSONSearch.shtml) function with a bad query. Now propergates the error properly.
- **Version 13.5**
    - Added [JSON.Search](https://www.mbsplugins.eu/JSONSearch.shtml) to perform JMESPath queries in FileMaker.

### Example Databases

- [JSON/JSON Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/JSON/JSON%20Query.shtml#3ScriptAnchor_)

### Blog Entries

- [JSON Search Example](https://www.mbsplugins.de/archive/2023-12-12/JSON_Search_Example/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.6pr1](https://www.mbsplugins.de/archive/2023-12-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 13.5](https://www.mbsplugins.de/archive/2023-11-28/New_in_MBS_FileMaker_Plugin_13/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 13.5 für Claris FileMaker](https://www.mbsplugins.de/archive/2023-11-07/Neues_MBS_Plugin_135_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.5 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-11-07/MBS_Plugin_135_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [Using JSONPath in FileMaker](https://www.mbsplugins.de/archive/2023-10-18/Using_JSONPath_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Checking out JSON.Search function in MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2023-10-17/Checking_out_JSONSearch_functi/monkeybreadsoftware_blog_filemaker)
- [JSON Query in FileMaker](https://www.mbsplugins.de/archive/2023-09-29/JSON_Query_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.5pr1](https://www.mbsplugins.de/archive/2023-09-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[JSON.ReplaceItemInObject](JSONReplaceItemInObject.md) - [JSON.SetFormatOptions](JSONSetFormatOptions.md)

[HTML Version](JSONSearch.shtml)