-1

我是 Gson 的新手,特别是在使用时让我感到困惑JsonElement.getAsJsonObject()的是 type JsonObject

它与 有什么区别JSONObject吗?

如果有,它们是什么?

如果它是相同的,有什么理由不能将它转换为JSONObject

4

1 回答 1

1

They are different classes from different packages from different sources (Gson is from Google, org.json is from Douglas Crockford), so no, you can't just cast one to the other. If you're using Gson, use Gson; if you're using org.json, use org.json.

于 2014-04-15T14:17:03.270 回答