JSON string from Gson: remove double quotes

前端 未结 3 1020
悲&欢浪女
悲&欢浪女 2020-12-30 19:28

Here is an example of my Json code:

array(\"id\" => 0, \"navn\" => \"Vind telefon\", \"udgiver\" => \"Telia\", \"beskrivelse\" => utf8_encode(\"V         


        
3条回答
  •  不思量自难忘°
    2020-12-30 20:05

    public class StringTypeSerializationAdapter extends TypeAdapter {
    
    
    public String read(JsonReader reader) {
        throw new UnsupportedOperationException();
    }
    
    public void write(JsonWriter writer, String value) throws IOException {
        if (value == null) {
            writer.nullValue();
            return;
        }
        writer.jsonValue(value);
    }
    }
    

    above will help you removing double quotes across strings. this is using GSON library

提交回复
热议问题