=JSONUPDATE
The =JSONUPDATE() function adds a new property to a JSON object or updates the value of an existing property. If the specified property already exists, its value is replaced. If it does not exist, the property is added to the JSON object.
Syntax
Section titled “Syntax”=JSONUPDATE(ExistingJsonObject; PropertyName; PropertyValue)Parameters
Section titled “Parameters”-
ExistingJsonObject: The JSON object to modify
-
PropertyName: The name of the property to add or update (as text)
-
PropertyValue: The new value to assign to the property
How It Works
Section titled “How It Works”The function evaluates the provided JSON object and looks for the specified property name. If the property is found, its value is updated with the new value. If the property is not found, it is added to the object. The function returns a new JSON object reflecting the change.
Usage Notes
Section titled “Usage Notes”-
The original JSON object is not modified; a new object is returned.
-
Property names are case sensitive and must match exactly.
-
The property value can be text, a number, a boolean, or a JSON object or array.
-
If the property already exists, its previous value is fully replaced.
-
Formula functions are case sensitive and must be written in ALL CAPS.
Examples
Section titled “Examples”Updating an Existing Property
Section titled “Updating an Existing Property”// Original customer objectCustomer = { "name": "John Smith", "email": "[email protected]", "status": "inactive", "lastLogin": "2025-01-15"}
// Update the status from "inactive" to "active"=JSONUPDATE(Customer; status; active)Result:
{ "name": "John Smith", "email": "[email protected]", "status": "active", "lastLogin": "2025-01-15"}Adding a New Property
Section titled “Adding a New Property”// Add a new "phone" property to the customer=JSONUPDATE(Customer; phone; 555-123-4567)Result:
{ "name": "John Smith", "email": "[email protected]", "status": "active", "lastLogin": "2025-01-15", "phone": "555-123-4567"}Keywords
Section titled “Keywords”JSONUPDATE, JSON, update JSON, modify JSON object, add JSON property, update JSON property, formula function, case sensitive functions