[wp-hackers] Why not json or xml instead of serialised data in DB
Deepak Mittal
dpac.mittal2 at gmail.com
Tue Jun 28 06:16:26 UTC 2011
I agree with that. JSON doesn't retain object information, but one can
typecast it, I suppose. Also, if one is storing a simple array, JSON is as
good as serialize with added flexibility. However, json_encode and
json_decode isn't available for PHP<5.0.
People are doing normal search and replace to change domain names in sql
dumps, which must've caused lots of trouble if domain length was different.
Let's just hope the 'Move wordpress' project in GSoC is successful this
time.
On Tue, Jun 28, 2011 at 9:12 AM, Otto <otto at ottodestruct.com> wrote:
> The json data format doesn't support all the same formats as PHP data
> can be. Javascript has limitations on variable names, for example.
> Also objects don't retain all the information when you put them in
> json. Things like that. PHP Serialization makes more sense if you're
> going to be processing the data in PHP. JSON serialization only really
> makes sense to send data to a browser to be used by javascript code.
>
> As for changing the data directly, if you have to do that, then kinda
> you're doing it wrong to start with, really. If you want to mess with
> the data, mess with it in PHP instead of directly.
>
> -Otto
>
>
>
> On Mon, Jun 27, 2011 at 9:26 PM, Deepak Mittal <dpac.mittal2 at gmail.com>
> wrote:
> > Just saw a post regarding how to move your domain on wp-hackers, and saw
> the
> > issue of serialised data. I knew it from before but just thought it'd be
> > extremely benefitial if wordpress used json or xml (json in particular).
> >
> > Although, I know it just takes one function to deserialise an array, same
> > level of simplicity can be introduced for a json file as well. I'm
> proposing
> > this because there are a lot of issues with serialised data in DB. For
> one
> > if there is just a change of single byte, the data goes corrupt. This
> > creates a lot of unneeded trouble for non-technical users.
> >
> > I'm sure I've missed some points as to why wordpress isn't using json and
> > I'm sure the developers must've already given a thought about it. Can
> > someone enlighten me?
> >
> > --
> > Regards,
> > Deepak Mittal,
> > Twitter - @dpacmittal
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Regards,
Deepak Mittal,
Twitter - @dpacmittal
More information about the wp-hackers
mailing list