[mapguide-users] n?Can someone check this parseJSON function It returns false and I don't know why?

n.adel n.adel at kemet.com.eg
Tue Jun 7 07:45:59 EDT 2011


I'm trying to parse this responseText:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{"properties":[{"name":"Autogenerated_SDF_ID","dataType":7,"distroTypes":[0,1,2,3,4]},{"name":"URL","dataType":9,"distroTypes":[0]},{"name":"NAME","dataType":9,"distroTypes":[0]},{"name":"ID","dataType":9,"distroTypes":[0]}],"scaleRanges":["0
- 1500"]}

in order to return the layer's properties.
I'm using Json.js in .Net
Here's the function

String.prototype.parseJSON = function () {
    try {
        return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
                this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
            eval('(' + this + ')');
    } catch (e) {
        return false;
    }
};

But it returns false.

Does anyone have the correct parse functions to use it with .Net.

Thanks in advance

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/n-Can-someone-check-this-parseJSON-function-It-returns-false-and-I-don-t-know-why-tp6449180p6449180.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list