【发布时间】:2021-07-27 08:01:00
【问题描述】:
我已经包含了 JsonException。 对于无响应、不同的键或值以及不同的 JSON 结构,我们有什么例外吗? 我在 android 中使用 kotlin。
【问题讨论】:
标签: android android-studio kotlin
我已经包含了 JsonException。 对于无响应、不同的键或值以及不同的 JSON 结构,我们有什么例外吗? 我在 android 中使用 kotlin。
【问题讨论】:
标签: android android-studio kotlin
JSONException 包括以下情况:
Attempts to parse or construct malformed documents
Use of null as a name
Use of numeric types not available to JSON, such as NaNs or infinities.
Lookups using an out of range index or nonexistent name
Type mismatches on lookups
如果您从网络获取 JSON,您应该处理其他异常,例如 IOException。这与 JSON 无关,也不包含在 JSONException 中。
【讨论】: