Consider a Java object like following:
class User {
String name;
int age;
String locationJson; // this is a json already
//allArgsConstructor, getters & setters
}
so when we do,
import com.fasterxml.jackson.databind.ObjectMapper;
....
User user = new User("Max", 13, "{\"latitude\":30.0000,\"longitude\":32.0000}");
new ObjectMapper().writeValueAsString(user)), String.class);
I was expecting something like:
{
"name": "Max",
"age": "13",
"locationJson": {"latitude":30.0000, "longitude":32.0000}
}
instead I got it as a json value wrapped into a double quotes and skipped by backslashes as it was double jsonized - if this is actually a verb -
{
"name": "Max",
"age": "13",
"locationJson": "{\"latitude\":30.0000, \"longitude\":32.0000}"
}