Re: [jQuery] json.js

2006-10-30 Thread Khurshid MUROD
Thanks a lot Mark, works fine.
Will make a page with some examples later for now just a link for those
who had/have the same problem

http://eboyreal.com/sandbox/jquery/jquery-json.js

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Gibson
Sent: Tuesday, 31 October 2006 1:39 AM
To: jQuery Discussion.
Subject: Re: [jQuery] json.js

Jörn Zaefferer wrote:
>> When I introcuded json.js [http://json.org/json.js] from
>> http://json.org/ . Problem now is my browser keeps freezing and
eating
>> up CPU.
>>
>> I checked and it is clearly conflicting with JQuery.
> 
> It extends Object, which seemes to cause lots of trouble with jQuery.
You could check if it works when removing Object.prototype.toJSONString.

Yeah, I had this problem, so I hacked the original json.js into a jQuery
plugin. It adds the two functions:

var json_str = $.toJSON(value)
var value= $.parseJSON(json_str, [safe])

If the optional safe argument is supplied as true, then the string will
be checked for valid JSON syntax.
Safety checks can be set globally by setting:

$.parseJSON.safe = true;


You can find the code here:

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

Regards
- Mark Gibson

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json.js

2006-10-30 Thread Mark Gibson
Jörn Zaefferer wrote:
>> When I introcuded json.js [http://json.org/json.js] from
>> http://json.org/ . Problem now is my browser keeps freezing and eating
>> up CPU.
>>
>> I checked and it is clearly conflicting with JQuery.
> 
> It extends Object, which seemes to cause lots of trouble with jQuery. You 
> could check if it works when removing Object.prototype.toJSONString.

Yeah, I had this problem, so I hacked the original json.js into a jQuery
plugin. It adds the two functions:

var json_str = $.toJSON(value)
var value= $.parseJSON(json_str, [safe])

If the optional safe argument is supplied as true, then the string will
be checked for valid JSON syntax.
Safety checks can be set globally by setting:

$.parseJSON.safe = true;


You can find the code here:

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

Regards
- Mark Gibson

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json.js

2006-10-30 Thread Dave Methvin
> I'm wondering if this is an easy condition to
> check for and generate an alert().

Put this at the end of your ready handler:

var test = {}; 
for ( var i in test ) alert("Warning: Object extended with property
'"+i+"'");

Something could extend Object after that, while your page is running, but it
will catch most included code. 



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json.js

2006-10-30 Thread Stephen Woodbridge
Jörn Zaefferer wrote:
>> When I introcuded json.js [http://json.org/json.js] from 
>> http://json.org/ . Problem now is my browser keeps freezing and
>> eating up CPU.
>> 
>> I checked and it is clearly conflicting with JQuery.
> 
> It extends Object, which seemes to cause lots of trouble with jQuery.
> You could check if it works when removing
> Object.prototype.toJSONString.

I ran into a similar problem with another script the extended Object. 
I'm wondering if this is an easy condition to check for and generate an 
alert(). This would give the developer am early heads up to what seems 
to be a potentially come problem.

-Steve

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json.js

2006-10-30 Thread Jörn Zaefferer
> When I introcuded json.js [http://json.org/json.js] from
> http://json.org/ . Problem now is my browser keeps freezing and eating
> up CPU.
> 
> I checked and it is clearly conflicting with JQuery.

It extends Object, which seemes to cause lots of trouble with jQuery. You could 
check if it works when removing Object.prototype.toJSONString.

--
Jörn Zaefferer

http://bassistance.de
-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json.js

2006-10-29 Thread Khurshid MUROD
Hi,

When I introcuded json.js [http://json.org/json.js] from
http://json.org/ . Problem now is my browser keeps freezing and eating
up CPU.

I checked and it is clearly conflicting with JQuery.

Did anyone had similar problem.

K


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/