[wp-hackers] json_encode/decode VS serialization

Nathan Rice ncrice at gmail.com
Sat May 21 04:17:54 UTC 2011


Now that WordPress 3.2 will support only PHP5+, is there any merit in
possibly starting to store arrays of data in the database via json_encode /
json_decode, instead of PHP serialized?

I've read conflicting reports about speed improvements, one even suggesting
that json_encode was slower than serialize, but json_decode was faster than
unserialize. [1]

Has anyone done any research into this, and is there any chance (assuming
reads would be faster with json_decode) that WordPress would switch to this
method over (un)serialize? Seems like it would at least be worth some
consideration.

1.
http://www.raditha.com/blog/archives/json_encodejson_decode-vs-serializeunserialize-and-fools-vs-idiots..html

------------------
Nathan Rice
WordPress and Web Development
www.nathanrice.net | twitter.com/nathanrice


More information about the wp-hackers mailing list