Friday, September 28, 2018

php - Why use CJSON encode when we have json_encode

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 additional parameters that can be customized in the native json_encode function like the JSON_NUMERIC_CHECK which is really useful. It creates


{
"id": 17
}

instead of Yii's CJSON encode which makes the '17' a string.


{
"id": "17"
}

So my question is whether there is any reason I should use CJSON encode instead of the built in PHP function json_encode ?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...