SET_PROPERTY function

SET_PROPERTY function

Function Name Description Usage Input parameter Return value
SET_PROPERTY Adds or updates a property in a JSON object. SET_PROPERTY(value) Property name and value. A JSON object with the newly added or updated property.

Supported data type

The SET_PROPERTY function supports the following data type:

  • JSON

Example: Add a property to a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY("radio","productName")

Add a property to var1.

Output: {"productId":23,"productName":"radio"}.

Example: Add a nested property to a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY({"productName","radio"},"productDetails")

Add a nested property to var1.

Output: {"productId":23,"productDetails":{"productName":"radio"}}.

Example: Update a property in a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY("34","productId")

Update the productId property in var1.

Output: {"productId":34}.

Recommendation

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年12月09日 UTC.