cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Json caused by characters in the description

dallinns
Champ on-the-rise
Champ on-the-rise
I have a webscript that returns a list of files as json. When a file has a description that has a line break in it then when I try to decode the json on the other side it is invalid. Is there a way to json ecode the description string in the ftl template? or in some other way?
1 REPLY 1

scouil
Star Contributor
Star Contributor
This should suit your needs:
http://freemarker.sourceforge.net/docs/ref_builtins_string.html#ref_builtin_json_string

So you'll end up with something like
${description?json_string});