JsonObject和JSONObject有什么区别 [英] What is different between JsonObject and JSONObject

查看:113
本文介绍了JsonObject和JSONObject有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JsonObject和JSONObject有什么区别?

我有点混淆了JsonObject和JSONObject,当我们使用put,add和addproperty方法时.

提前谢谢.

解决方案

Android SDK提供了JSONObject.可以通过导入org.json.JSONObject来使用.

此处.

任何其他变体都将来自库或链接的项目. cricket_007给出的示例来自Gson库中的JsonObject.可以通过导入com.google.gson.JsonObject来使用.

JsonObject的文档位于此处. /p>

请注意JSONObjectJsonObject的import语句的区别-它们是不同程序包中的不同类.它们可以具有不同的方法和功能,采用不同的参数等,但是最终它们将做相同或相似的事情(持有Json Object的内容).取决于您的使用方式.每个JavaDoc都将描述如何使用它,并且每个JavaDoc都有大量在线资源.

What is different between JsonObject and JSONObject?

I am little bit confuse JsonObject and JSONObject and when we use put, add and addproperty method.

thanks in advance.

解决方案

The Android SDK provides JSONObject. This can be used by importing org.json.JSONObject.

The documentation for JSONObject is here.

Any other variant will be from a library or linked project. The exmaple given by cricket_007 is JsonObject from the Gson libraries. This can be used by importing com.google.gson.JsonObject.

The documentation for JsonObject is here.

Note the difference in import statement for JSONObject and JsonObject - they are different classes in different packages. They can have different methods and functionality, take different parameters etc, but ultimately they will do the same or similar thing (holding a Json Object's contents). It is up to you which you use. The JavaDoc for each will describe how to use it, and there are plenty of resources online for each.

这篇关于JsonObject和JSONObject有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆