In Smarty, is there a standard function or an easy way to generate json from an array, as json_encode()
does in php?
I could not see it in Smarty docume
I don't know of any. You could assign the json_encode()'s result to a smarty variable in your 'php code' with $smarty->assign( ... ), and then use it in your template.
Also there is a Smarty extension for json_decode(). It shouldn't be hard to write your own extension for the opposite based on this.