JSON Decode
The json::decode
function parses a JSON string and converts it into a structured object, such as a map or list.
Syntax
json::decode(<json-string>)
Parameters
json-string
: The JSON string to decode.
Returns
- Object: The structured representation of the JSON string, which can be a map or a list depending on the input.
Example
json::decode("{\"name\": \"Alice\", \"age\": 30}")
This function is useful for processing JSON data and extracting specific fields for testing or validation.