[OpenLayers-Dev] native JSON
Slawomir Messner
slawomir.messner at staff.uni-marburg.de
Thu Feb 17 03:07:09 EST 2011
Hi,
some revisions ago the JSON.js is changed to use the native browser
possibilities. But now arrays are in double quotes(see example below)
and our backend has problems with deserialize it. As I know it is that
the JSON format has no double quotes around arrays. So where is the
error, is the native serializer(Firefox and Chrome) not producing a
standard format? With the old code (before native browser function is
used) all was fine.
The object we pass to the OL.Format.JSON.write has the
features-attribute as array I tested it in firebug/chrome-dev-tools. I
don't know why it should be a string after serializing.
Example:
{"type":"FeatureCollection","properties":{},"defaultStyle":{"pointRadius":"4","fillColor":"#008700","fillOpacity":"0.6","stroke":"True","strokeColor":"#21007E","strokeOpacity":"0.9","strokeWidth":"1","strokeDashstyle":"solid","label":"","fontFamily":"Arial","labelAlign":"lb","display":""},
"features":"[{\"type\": \"Feature\", \"id\":
\"OpenLayers.Feature.Vector_339\", \"properties\": {\"gid\": 101225,
\"title\": \"VREDEN\", \"ownerType\": 1, \"style\": {\"label\": \"<font
color='#FF0000' bold='false' italic='false' sizeFactor='1' >[Â</font>\",
\"fontFamily\": \"SprachGIS-Symbole2\"}, \"symbols\": [26373, 26367],
\"wktGeometry\": \"POINT(759321.378649999 6806065.527048201)\"},
\"geometry\": {\"type\": \"Point\", \"coordinates\": [759321.378649999,
6806065.527048201]}}, {\"type\": \"Feature\", \"id\":
\"OpenLayers.Feature.Vector_341\", \"properties\": {\"gid\": 101252,
\"title\": \"MILLINGEN\", \"ownerType\": 1, \"style\": {\"label\":
\"<font color='#FF0000' bold='false' italic='false' sizeFactor='1'
>Â</font>\"...
Has someone the same experience?
Thanks for help in advance.
Slawomir
More information about the Dev
mailing list