Use built-in json functions in PHP instead of third-party Services_JSON library #281

merged 3 commits into from Mar 31, 2012


None yet
2 participants

halkyon commented Mar 31, 2012

Remove Services_JSON and use built-in json functions provided by PHP instead.

There's another pull request for CMS which fixes a broken test, because Convert::json2array() didn't recursively create arrays of nested JSON structures, but it created objects instead, so this change to built-in json functions has the effect of being easier to traverse the JSON converted to PHP arrays, not to mention less code and faster. I've checked the CMS batch actions JS to make sure it's not broken, and it appears to be all good.

I've added this change information to the upgrade notes, as it seems like anyone relying on objects in nested JSON should probably know how to fix their code when upgrading from 2.4.

Please merge this pull from CMS after merging this: silverstripe/silverstripe-cms#84

halkyon added some commits Mar 30, 2012

@halkyon @halkyon halkyon API CHANGE Remove use of Services_JSON and replace with json_encode()…
… and json_decode()

API CHANGE Convert::json2array() will convert nested JSON structures to array as well for easier traversal, instead of array with nested objects.
@halkyon @halkyon halkyon API CHANGE Removed Services_JSON library, as we use the built-in json…
… functions instead.
@halkyon halkyon MINOR Add notes on upgrading for Convert::json2array() changes c52f75e

stojg commented Mar 31, 2012

Sweet! Be gone obsolete code!

@stojg stojg added a commit that referenced this pull request Mar 31, 2012

@stojg stojg Merge pull request #281 from halkyon/json_changes
Use built-in json functions in PHP instead of third-party Services_JSON library

@stojg stojg merged commit 8913bf7 into silverstripe:master Mar 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment