The difference between getString() and optString() in Json

前端 未结 5 801
时光说笑
时光说笑 2020-11-30 22:39

What is the difference between getString() and optString() in JSON?

5条回答
  •  一向
    一向 (楼主)
    2020-11-30 23:34

    public java.lang.String optString(int index) Get the optional string value associated with an index. It returns an empty string if there is no value at that index. If the value is not a string and is not null, then it is coverted to a string. Parameters: index - The index must be between 0 and length() - 1. Returns: A String value.

提交回复
热议问题