java - JSON variable substitution placeholders -


I'm looking for a Java library that can substitute variable when jashing is done for marshaling on-the-fly is. For example, there will be variable replacement sites / placeholders in the Jason Template such as:

  {"user": {"name": "$ {name}", "age" $ {Age}} }  

The result of the Java object will be the following rained following:

  {"user": {"name" elvis "," edge " : 80}}  

What I want, there is something on this:

  ObjectMapper mapper = New ObjectMapper (); User user = Mapper.Read Value (new file ("c: \\ user.json.template"), y Zero.Class, "Elvis", 80); This is really the scope for the JSON library, because JSON format has no support for itself.  

Or the notion of variable replacement can be your best bet for Jackson to use a Jason Library (like Jackson) (for Jackson, which is JsonNode is ), then attack it, and another book to handle the replacement of the text Use rhythm. Many such people can do that, from stringtemplate to other (maybe MessageFormat refer to another answer).

This is also possible second, if your replacement is never funny "funny characters" (quotes, line feeds); If so, you can use string templateing lab before, JSON parser next feeding processing text. But this is a little dangerous, because usually there is a case where you add a quote, and then the parsing is trying to fail.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -