Closed kkms closed 3 years ago
Yes. It is possible. Just configure your own jackson mapper with this feature and use it with the library. In few hours will gave you a sample
If you will be unable to find that method yourself till that time
Thanks @msangel But I think issue is related to Template parsing. number field in the template is causing the issue.
@bkiers
Just dig into this.
Yes, this is lexer problem.
in place where we have
lookup > index > id2
the lexer gives here DoubleNum, as the match string is DoubleNum: 1.
.
So far have no idea how to fix this properly... as this is lexer problem, not a parser...
Indeed, a lexer issue. Ruby's Liquid engine handles such cases properly:
data = { 'Data' => { '1' => { 'Value' => 'tobi' }} }
@template = Liquid::Template.parse("hi {{Data.1.Value}}")
puts @template.render(data)
# hi tobi
So it's a bug in Liqp. One I don't really have a nice way of handling though 🤷
It appear to be valid to put a number as a key only in nested objects. So this is valid:
{ 'Data' => { '1' => { '2' => 'mu' } } }
but this is not:
{ '1' => { 'Data' => { '2' => 'mu' } } }
This means I can recognize a so-called "ID chain" in the lexer (like "Data.1.2"
) and let the lexer chop this up in a separate method in the 5 tokens: Id
, Dot
, Id
, Dot
and Id
. I'll give this a try tonight.
Following example throws me exception, Is it possible to use number as Key?