Re: Specifying a list literal as hash item value

Lee <[email protected]> Tue, 10 Nov 2015 08:17:39 -0800
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CACZMt7xADFQ8Gy0YJES+oYT8-1WebnCNcAK+V219nPyu7uY7WQ@mail.gmail.com>
--===============2369781853089473475==
Content-Type: multipart/alternative; boundary=047d7b2e12df7701ba0524320c18

--047d7b2e12df7701ba0524320c18
Content-Type: text/plain; charset=UTF-8

It needs to be in a JSON-like format.

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

On Tuesday, November 10, 2015, Albert Kam <[email protected]> wrote:

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

--047d7b2e12df7701ba0524320c18
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It needs to be in a JSON-like format.=C2=A0<div><br></div><div>&lt;#assign =
test =3D {</div><div>=C2=A0 =C2=A0 &quot;hello&quot;: [&quot;hello world&qu=
ot;]</div><div>}&gt;<br><br>On Tuesday, November 10, 2015, Albert Kam &lt;<=
a href=3D"mailto:[email protected]">[email protected]</a>&gt;=
 wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I tried to speci=
fy a list literal as hash item value like this,<div><div><br></div><div>&lt=
;#assign test=3D{</div><div><span style=3D"white-space:pre-wrap">	</span>he=
llo=3D[ &#39;hello world&#39; ]</div><div>}&gt;</div><div><br></div><div>An=
d i got this exception:</div><div><div>java.lang.RuntimeException: freemark=
er.core.ParseException: Syntax error in template &quot;my.cfg&quot; in line=
 2713, column 15:</div><div>Found list literal: [&quot;hello world&quot;]. =
Expecting scalar</div><div><span style=3D"white-space:pre-wrap">	</span>at =
app.cfg.Manager.interpolatedCfg(Manager.java:111)</div><div><br></div></div=
><div><span style=3D"white-space:pre-wrap">Is this not supported ?</span><b=
r></div><div><span style=3D"white-space:pre-wrap"><br></span></div>-- <br><=
div>Do not pursue the past. Do not lose yourself in the future. <br>The pas=
t no longer is. The future has not yet come. <br>Looking deeply at life as =
it is in the very here and now, <br>the practitioner dwells in stability an=
d freedom.<br>(Thich Nhat Hanh)</div>
</div></div>
</blockquote></div>

--047d7b2e12df7701ba0524320c18--


--===============2369781853089473475==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------

--===============2369781853089473475==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user

--===============2369781853089473475==--