I am building an API for a website using Yii. I know that there is a utility class called CJson and has a function called encode.
As far as I know there are addition
I realise this is an old topic, but wanted to add another reason.
By doing all JSON encoding through a helper class like CJSON you can override default behavior. For example you can use it to add a token to prevent JSON hijacking.