Hi,
In Smarty, is there a standard function or an easy way to parse json from an array, as json_encode() does in php? Actually It seems there is not in smarty documentation but wanted to ask anyways.
Thanks, Sinan.
Hi,
In Smarty, is there a standard function or an easy way to parse json from an array, as json_encode() does in php? Actually It seems there is not in smarty documentation but wanted to ask anyways.
Thanks, Sinan.
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.