【发布时间】:2019-08-01 06:57:58
【问题描述】:
我正在尝试通过使用 Unity 的 REST API 来使用 Firestore。到目前为止,一切都按预期工作。
从 Firestore 读取文档时,它返回不同格式的 json。 像这样。
{
"name": "projects/firestore-unity-demo-87998/databases/(default)/documents/test/panara",
"fields": {
"health": {
"integerValue": "1008"
},
"name": {
"stringValue": "Bhavin Panara"
},
"birthday": {
"timestampValue": "1992-10-08T04:40:10Z"
},
"alive": {
"booleanValue": true
},
"floatingPointNumber": {
"testFloat": 100.1
}
},
"createTime": "2019-07-30T13:27:09.599079Z",
"updateTime": "2019-07-31T11:41:10.637712Z"
}
我怎样才能将这种json转换成这样的普通json。
{
"health":1008,
"name":"Bhavin Panara",
"birthday" : "1992-10-08T04:40:10Z",
"alive":true,
"floatingPointNumber":100.1
}
【问题讨论】:
-
你是如何查询数据库的?您能否提供更多代码,因为可能存在对象解析的替代方法
-
我正在使用 REST API。 firebase.google.com/docs/firestore/reference/rest/v1/…
-
你可以使用firestore-parser
-
我希望在 Unity 中执行此操作。 firestore-parser 用于网络。不是吗?
标签: json firebase google-cloud-firestore json.net