简体   繁体   English

在 Android 中将 JsonObject 转换为 ParseObject

[英]Convert JsonObject to ParseObject in Android

I am sending out ParseObject through push notification so that I may store them locally on the users device.我通过推送通知发送 ParseObject,以便我可以将它们本地存储在用户设备上。 How can make a ParseObject from the JsonObject which is coming through the notifications?如何从通过通知传来的 JsonObject 制作 ParseObject?

The Best way to do it is to use the ParseObject.fromJSON() method.最好的方法是使用 ParseObject.fromJSON() 方法。

It takes three parameters : JsonObject , DefaultClassName , ParseDecoder它需要三个参数: JsonObject 、 DefaultClassName 、 ParseDecoder

An example code would be :示例代码是:

ParseDecoder decoder = ParseDecoder.get(); ParseObject obj = ParseObject.fromJSON(MyJsonObject,"object_class_name", decoder);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM