PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Serialize vs JSON?

  1. Hey gang,

    I know WP chooses to use Serialization for their data storage, but what would the benefits be vs JSON? I'm mainly asking because I just pulled a value out of the DB table to manually change a field's type (changed type from s:8:"checkbox" to s:5:"radio"), when I put it back my form was nuked and that change was the only thing I did. Now that I try, I can't seem to get the value stored in the DB to even unserialize for other forms, so I'm thinking maybe it's my GUI or something else...

    Anyways, I'm wondering if you'll eventually go the JSON method as it isn't as finicky. Also wondering if anyone else has had the same issue editing the form_meta serialized array for a form.

    Posted 12 years ago on Tuesday August 17, 2010 | Permalink
  2. Here is some info from StackOverflow on the subject...

    There are nesting limits with JSON, as well as some PHP capabilities with serialize that aren't available with JSON. There are some performance gains with JSON for encoding, but serialized is quicker to unserialize than JSON to decode...

    Really it sounds like it's a toss up with JSON having a portability advantage if you plan on using the data elsewhere. I don't think one is definitively better than the other, a lot of it is opinion and what you are comfortable using.

    Posted 12 years ago on Wednesday August 18, 2010 | Permalink
  3. Any thoughts on recovery of a serialized form meta string?

    Posted 12 years ago on Wednesday August 18, 2010 | Permalink
  4. I can't speak to that, you'd be better off talking to Alex. I know the form meta has to be handled with care otherwise one wrong move and the form will have issues. I can give you his email address via IM if you wanted to ask him a question... or you can talk to him in Dallas next week as he will be there with the rest of the team.

    Posted 12 years ago on Wednesday August 18, 2010 | Permalink