Probably it's not possible,
but I would like to transform a json string in a map with freemarker
ex:
<#assign test = "{\"foo\":\"bar\", \"f\":4, \"text\":\"bla bla\"}">
and be able to get the text key from this string
Probably it's not possible,
but I would like to transform a json string in a map with freemarker
ex:
<#assign test = "{\"foo\":\"bar\", \"f\":4, \"text\":\"bla bla\"}">
and be able to get the text key from this string
Use
?eval
. It works because JSON maps happen to be valid FreeMarker expressions (update: except thatnull
is not recognized in FreeMarker 2.3.x).(BTW, you don't have to use
\"
if you quote the string with'
instead of"
.)freemarker.sourceforge.net/docs/pgui_datamodel_method.html
in code:
in the template:
Sounds like you need to define/implement a template that reads JSON.