cancel
Showing results for 
Search instead for 
Did you mean: 

JSON and number format

orichaud
Champ in-the-making
Champ in-the-making
Hi,

I have a slight problem in a JSON webscript. This is a java backed web script and I return a set of POJO to the freemarker template. SOme attributes of the object are int and float. However, freemarker formats number and introduces separators for thousands which leads to errors when parsing the JSON stream.
So the question is simple: How can I prevent Freemarker from formatting numbers when not necessary?

Regards.

Olivier
2 REPLIES 2

sufo
Star Contributor
Star Contributor
Did you try something like this ${myNumber?c} ?
?c added to your variable is exactly what you need, it outputs numbers readable by computers  Smiley Very Happy http://freemarker.sourceforge.net/docs/ref_builtins_number.html

orichaud
Champ in-the-making
Champ in-the-making
Thanks it works.