PHP JSON Extension

White Lotus picture White Lotus · Dec 29, 2015 · Viewed 7.5k times · Source

I have already seen posts mentioning this on StackOverflow, but there is something I'm not understanding.

The json module for php is installed using apt-get install php5-json. I read from the PHP site that the json extension is no longer supported as of PHP 5.4, due to a license conflict or something like that.

Is it still safe or good to use an old extension like php5-json?

Answer

Will picture Will · Dec 29, 2015

There is a working php5-json module shipped with all versions of PHP. In PHP7, however, the underlying code is replaced with code from the jsond extension, which has resulted in some noticeable changes related to more strict compliance with the JSON RFC.

Now, Debian replaced the non-free JSON extension in PHP 5.5 with a free implementation, and I'm not sure if it's even the same free implementation (jsond) used in PHP 7.0. So, in short, you may notice differences between these various implementations in how they handle non-strict JSON, but, all versions of PHP are shipping with a json extension that is API-compatible. If you're using strict, compliant JSON, you'll never notice a thing!