Code example for JsonPrimitive

0
public class EntitySerializer implements JsonSerializer<Entity> { 
 
    @Override 
    public JsonElement serialize(final Entity src, final Type type, final JsonSerializationContext jsonSerializationContext) { 
        final String j = GsonFactory.getSimpleInstance().toJson(src); 
        return new JsonPrimitive(j); 
    } 
} 
Experience pair programming with AI  Get Codota for Java