I have a web service that accepts a JSON and I use GSON to convert the JSON string into a POJO.
POJO Example:
class POJO{
AtomicReference<String> property;
}
JSON string example:
{"property":"val"}
However when the JSON string gets parsed by GSON, it throws a JSONSyntaxException because it expects the JSON string to be:
{"property":{"value":"val"}}
Do I just have to write a counterpart of the POJO (POJO2) with non-concurrent variables and then initialize my POJO (POJO1) with concurrent variables by using the POJO2 values? Or, is there a way to make GSON to treat the AtomicReference variable as a String?
If I do the former, it takes away the feature of GSON to output an object from a json string on the fly.