From 4b2d85a3d3ad039cdbd107d888f358cf13f88c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Tue, 4 Jun 2024 14:15:47 +0800 Subject: [PATCH] Update utsjsonobject.md --- docs/uts/buildin-object-api/utsjsonobject.md | 31 +++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/uts/buildin-object-api/utsjsonobject.md b/docs/uts/buildin-object-api/utsjsonobject.md index 96160a3a..ea8f7b2e 100644 --- a/docs/uts/buildin-object-api/utsjsonobject.md +++ b/docs/uts/buildin-object-api/utsjsonobject.md @@ -214,6 +214,29 @@ console.log(genericArray) ``` +### parse(): T | null + + + + + + + + + +```ts +type A = { + x:number, + y:string, +} +let rootObj = JSON.parseObject('{"x":111,"y":"aaa","t":{"name":"zhangsan"}}') +let a = rootObj!.parse() +// UTSJSONObject +console.log(rootObj) +// A +console.log(a) +``` + ### toMap(): Map @@ -234,15 +257,7 @@ person.toMap().forEach((value, key) => { -### parse(): T | null - - - - - - - ## 注意事项 -- GitLab