Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.Replace
Searches for all values that match the JSONPath expression and replaces them with the specified value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 13.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | "{\"people\":[{\"first\":\"Christian\",\"last\":\"Schmitz\",\"city\":\"Nickenich\"}]}" |
path | The path to query. | "$.books[?(@.title == 'A Wild Sheep Chase')].price" |
ReplaceJSON | The new JSON value. | 123 |
Result
Returns JSON or error.
Description
Searches for all values that match the JSONPath expression and replaces them with the specified value.Returns an error if JSONPath evaluation fails.
See also JSON.Query to just search without replace.
Examples
Find an entry in the books array and change the value:
Let([
json = "{
\"books\": [
{
\"author\": \"Haruki Murakami\",
\"category\": \"fiction\",
\"price\": 20.0,
\"title\": \"A Wild Sheep Chase\"
},
{
\"author\": \"Sergei Lukyanenko\",
\"category\": \"fiction\",
\"price\": 23.58,
\"title\": \"The Night Watch\"
},
{
\"author\": \"Graham Greene\",
\"category\": \"fiction\",
\"price\": 21.99,
\"title\": \"The Comedians\"
},
{
\"author\": \"Phillips, David Atlee\",
\"category\": \"memoir\",
\"title\": \"The Night Watch\"
}
]
}";
output = MBS( "JSON.Replace"; json; "$.books[?(@.title == 'A Wild Sheep Chase')].price"; 123 )
]; output)
See also
Release notes
- Version 13.5
- Added JSON.Replace to replace within a JSON.
Example Databases
Blog Entries
- Neues MBS Plugin 13.5 für Claris FileMaker
- MBS Plugin 13.5 for Claris FileMaker
- Using JSONPath in FileMaker
- Checking out JSON.Search function in MBS FileMaker Plugin
- JSON Query in FileMaker
- MBS FileMaker Plugin, version 13.5pr1
FileMaker Magazin
This function checks for a license.
Created 17th September 2023, last changed 13th October 2023
