Using GSON do not parse a field, only keep it with the json raw string

Kenenisa Bekele :

Using GSON in Java is there any annotation where I can indicate a field that it should keep it as a raw string even though it is an object. ?

Or What would be the easiest way to achieve this?

//This is the original
    @SerializedName("perro")
    public Perro perro

//This is what I want to achieve 
    @SerializedName("perro")
    public String perro

So the result should be 
perro = "{"Users":[{"Name":"firulais","Raza":"beagle"},{"Name":"Spike","Value":"Terrier"}]}"
Kenenisa Bekele :

The only way I found this to work was using

public JsonElement perro;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=470950&siteId=1