Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
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 |
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 |
Returns JSON or error.
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)
This function checks for a license.
Created 17th September 2023, last changed 13th October 2023