Remove quote from the JSONArray output

后端 未结 13 1941
野性不改
野性不改 2021-01-02 02:45

On the successful call, I am getting the JSONArray with the key \"objects\" and again the testValue with the key \"name\". The output is Like:



        
13条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 03:13

    This thread is pretty old, but I stumbled upon the same problem an hour ago and found the correct solution. You have to check for the type of JsonValue and if its a JsonString, you can parse it to JsonString and call its getString() method.

    if(val.getValueType().equals(JsonValue.ValueType.STRING)) {
      c.setValue(((JsonString) val).getString());
    } else {
      c.setValue(val.toString());
    }
    

提交回复
热议问题