JSONDecode
JSONDecode
The JSONDecode block is an operator, that allows to decode input string from JavaScript Object Notation (JSON) format to output arguments named as JSON attributes.
Arguments
Name | Appearance | Description |
---|---|---|
In | Predefined input argument | The JSON-formatted string |
JSON attribute name to find | Any number of user-configurable output arguments | Argument name will be searched from the JSON attributes list (from the top-level only) and when found, the attribute value will be set to this argument value. When the attribute named as the argument is not found, then the argument value will be set to empty (or 0 for numeric arguments). |
Example
The following block diagram shows how to decode a JSON string like this:
{ "name": "temp", "value": 25.6 }
For that, 2 output arguments were added to the JSONDecode block (named name and value). Then, these attributes will be looked from the input JSON string and when found, their values will be set to the argument values, as can be seen in the block diagram:
See also JSONDecoder, JSONEncode, and Argument.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.