I am looking for a Java library that can perform variable substitution when marshaling Json onto an object on the fly.
For example, the Json template will have variable substitution sites / placeholders, such as:
{ "User": { "Name": "${name}", "Age": ${age} } }
which would result in a Java object representing the next time marshaled:
{ "User": { "Name": "Elvis", "Age": 80 } }
I want something like this:
ObjectMapper mapper = new ObjectMapper(); User user = mapper.readValue(new File("c:\\user.json.template"), User.class, "Elvis", 80);
source share