Code example for JsonPrimitive

0
public class TextAdapter implements JsonSerializer<Text>, JsonDeserializer<Text> {
 
	@Override 
	public JsonElement serialize(Text src, Type typeOfSrc,
			JsonSerializationContext context) {
		return new JsonPrimitive(src.getValue());
	} 
 
	@Override 
	public Text deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {
		return new Text(json.getAsString());
	} 
 
}