handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

json changes “:” to “=” in Helper class

Open sadiasher opened this issue 5 years ago • 0 comments

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();

sadiasher avatar Jun 24 '19 11:06 sadiasher