JsonUtils

Last Updated on : 2023-10-12 08:00:24download

This topic describes the utility method that is used to parse a JSON string.

API operation name

parseJSON

API description

Return the result after the JSON string is parsed.

Request parameter

Name Data type Description Required
str string String Yes

Return parameter

Name Data type Description
finalObj object The result after the JSON string is parsed.

Sample request

import { Utils } from "tuya-panel-kit"; const { parseJSON } = Utils.JsonUtils; parseJSON(str); //Example: parseJSON("{a:1, b:2}");

Sample response

{a: 1, b: 2}