提交 a72624e0 编写于 作者: 杜庆泉's avatar 杜庆泉

Update utsjsonobject.md

上级 60234d8e
......@@ -20,7 +20,20 @@ const person: UTSJSONObject = {
* 通过 JSON 字符串
```ts
// 写法1 推荐
const person: UTSJSONObject = JSON.parseObject('{"name":"Tom"}')!
// 写法2 推荐
const person: UTSJSONObject = JSON.parse<UTSJSONObject>('{"name":"Tom"}')!
// 写法3 as 操作符 实际类型不匹配 会导致 crash,建议先通过 instanceOf 进行判断再进行转换。
const parseRet = JSON.parse('{"name":"Tom"}')
if(parseRet instanceof UTSJSONObject){
const person = parseRet as UTSJSONObject
}
```
## 实例方法
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册