handlebars.java
handlebars.java copied to clipboard
json changes “:” to “=” in Helper class
I wrote helper class to assign value in a variable through syntax
{{ var "$a" jsonObj }}
I got inspiration from enum "NumberHelper" and write my own enum VarHelper. Here is "Var" code
var { @Override public CharSequence safeApply(final String variableName, final Options options) throws IOException { System.out.println( options.params[0]); options.context.data(variableName, options.params[0]); return null; } };
options.params[0] returns JSON value with "=" sign rather than ":" how can i colve this problem?
Here is how i create context
JsonNode jsonNode = objectMapper.readValue(file, JsonNode.class); Context context = Context .newBuilder(jsonNode) .resolver(JsonNodeValueResolver.INSTANCE) .build();