Discussion:
[FreeMarker-user] Specifying a list literal as hash item value
Albert Kam
2015-11-10 10:07:26 UTC
Permalink
I tried to specify a list literal as hash item value like this,

<#assign test={
hello=[ 'hello world' ]
}>

And i got this exception:
java.lang.RuntimeException: freemarker.core.ParseException: Syntax error in
template "my.cfg" in line 2713, column 15:
Found list literal: ["hello world"]. Expecting scalar
at app.cfg.Manager.interpolatedCfg(Manager.java:111)

Is this not supported ?
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
Lee
2015-11-10 16:17:39 UTC
Permalink
It needs to be in a JSON-like format.

<#assign test = {
"hello": ["hello world"]
}>
Post by Albert Kam
I tried to specify a list literal as hash item value like this,
<#assign test={
hello=[ 'hello world' ]
}>
java.lang.RuntimeException: freemarker.core.ParseException: Syntax error
Found list literal: ["hello world"]. Expecting scalar
at app.cfg.Manager.interpolatedCfg(Manager.java:111)
Is this not supported ?
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
Albert Kam
2015-11-10 16:29:32 UTC
Permalink
Ah, thanks so much!
Post by Lee
It needs to be in a JSON-like format.
<#assign test = {
"hello": ["hello world"]
}>
Post by Albert Kam
I tried to specify a list literal as hash item value like this,
<#assign test={
hello=[ 'hello world' ]
}>
java.lang.RuntimeException: freemarker.core.ParseException: Syntax error
Found list literal: ["hello world"]. Expecting scalar
at app.cfg.Manager.interpolatedCfg(Manager.java:111)
Is this not supported ?
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
Loading...