Say I have a basic class in Java:
public class Person{
public String name;
}
When I give an object, instantiated with the name of "bob", to gson to serialize, it comes back as :
{"name" : "bob"}
How can I make it so it gives me:
{name:"bob"}
I know this is a simple question, but I'm not finding anything to help me in the API, and I apparently don't know the terminology well enough for json to do searches good enough to find the answer.
Yeah, as mentioned above, the JSON spec expects quotes.
Now, if you really want your stuff, you can try creating your own JSONWriter
and passing it to Gson.toJson(Object src, Type typeOfSrc, JsonWriter writer) throws JsonIOException
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With