AnsweredAssumed Answered

jsonUtils.encodeJSONString(x) json

Question asked by xsp on Nov 8, 2012
Latest reply on Nov 29, 2012 by jhesparrach
Hi,

I have a webscript that accpet the get as html and json. The html runs fine, but the json ones return a …Expression jsonUtils.encodeJSONString(x) … error  The exact error is:


"message" : "10080009 Wrapped Exception (with status template): 10080137 Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 1, column 15 in com\/test\/countries.get.json.ftl.'. Please contact your system administrator.", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 10080009 Wrapped Exception (with status template): 10080137 Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 1, column 15 in com\/test\/countries.get.json.ftl.'. Please contact your system administrator.",

My json script (countries.get.json.ftl, …which returns the countries which are a custom type) is:


<#escape x as jsonUtils.encodeJSONString(x)>
{
"Results" : [
  <#list countries as country>
    {"label":"${country.label}", "value":"${country.value}"},
   </#list>
   ]
}
</#escape>

Can anyone tell what is wrong in the json script? …also, I didn't find proper documentation of how to writting a simple json script for a custom type.

Thanks in advance.

Outcomes