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

Update json.md

上级 aa22a5f6
......@@ -34,13 +34,13 @@ console.log(obj["result"]);
<!-- UTSJSON.JSON.parse.returnValue -->
```ts
class Persion {
var name =""
var age = 0
class Person {
name:string = ""
age:number = 0
}
// 带泛型的parse,这里的personObj 类型是 我们定义的`Persion`类
let personObj = JSON.parse<Persion>('{"name":"zhangsan","age":12}')
let personObj = JSON.parse<Person>('{"name":"zhangsan","age":12}')
// 不带泛型的parse,这里的jsonObj类型是通用的`UTSJSONObject`
let jsonObj = JSON.parse('{"name":"zhangsan","age":12}')
```
......@@ -124,4 +124,4 @@ console.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5)));
<!-- UTSJSON.JSON.parseArray_1.returnValue -->
<!-- UTSJSON.JSON.parseArray_1.compatibility -->
\ No newline at end of file
<!-- UTSJSON.JSON.parseArray_1.compatibility -->
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册