[Json-rpc-java] import javascript scoping issue

Anthony Krinsky anthonykrinsky at hotmail.com
Sun Jun 11 09:09:13 SGT 2006


Jason,

Fabulous code.  Thanks for writing it!!!  Here's a small fix.

In the "toJSON(o)" function, there is an issue with scoping in the final 
portion.

	for(attr in o) {
	    if(o[attr] == null) v.push("\"" + attr + "\": null");
	    else if(typeof o[attr] == "function"); /* skip */
	    else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
	}

Needs to have "attr" scoped or many 3rd party libraries that similarly use 
"attr" may break unexpectedly.

Add this "var" in here:

	for(var attr in o) {

Thanks again

Anthony




More information about the Json-rpc-java mailing list