HarmonyOS Map解析?

json字符串为:

{"as":{"1":"0"},"cmd":"xxx","from":"yyy"}  

如何解析成对象Test:

class Test {
  cmd: string = ""
  from: string = ""
  as: Map<String, Object> = new Map()
}
let a: Test = JSON.parse(json); 

这样不行么,json解析成map对象是如何解析的?

阅读 454
logo
HarmonyOS
子站问答
访问
宣传栏