diff --git a/docs/uts/buildin-object-api/json.md b/docs/uts/buildin-object-api/json.md index a48bcab371ab7fb0b9d40d97940ace72843bf9c1..d82a400ec4d931753831614d15cf7e954474bf7c 100644 --- a/docs/uts/buildin-object-api/json.md +++ b/docs/uts/buildin-object-api/json.md @@ -34,13 +34,13 @@ console.log(obj["result"]); ```ts -class Persion { - var name ="" - var age = 0 +class Person { + name:string = "" + age:number = 0 } // 带泛型的parse,这里的personObj 类型是 我们定义的`Persion`类 -let personObj = JSON.parse('{"name":"zhangsan","age":12}') +let personObj = JSON.parse('{"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))); - \ No newline at end of file +