> 2)  Best way to create a toJSON() string or object.
> I didn't see a direct way to do this, if not, is this best way:
>    // Create JSON from form input id="wc*" fields
>
>    $jj = $('[EMAIL PROTECTED]').get();
>    json = {};
>    try {
>       for (var j=0; j <$jj.length; j++) {
>          json[$jj[j].getAttribute("name")] = $jj[j].value;
>       }
>    } catch(e) {
>      alert("EXCEPTION:\n\n"+e);
>      return false;
>    }

You need to recurse so that you can get subobjects-arrays.

Mark Gibson wrote a lightweight jQuery plugin with $.toJSON() and
$.parseJSON():

http://jollytoad.googlepages.com/json.js

I haven't tried it out, yet, but it looked good at a cursory glance.

Pyro

Reply via email to