Ahhhh nuts.... I just answered my own question:

A DirectionsResult contains an array of DirectionsRoutes, and each
DirectionsRoute contains a overview_path property that is an array of
LatLng *objects*.

Those LatLng objects aren't JSON, so they're not handled by the
stringify and parse of the JSON library in json2.js. (As William
correctly pointed out.)

Bugger!

I'm off to explore options for property javascript *object*
serialisation. Any advice/tips/pointers are welcome!

Thanks all!


On Aug 31, 8:38 pm, Stewart <[email protected]> wrote:
> Hi William -
>
> Are you saying that the DirectionsResult isn't plain JSON after all?
> The API says:
>
> "The directions response in JSON format retrieved from the directions
> server."
> (http://code.google.com/apis/maps/documentation/javascript/
> reference.html#DirectionsResult)
>
> So I assumed it was plain JSON I could serialise/deserialise using
> json2.js. :-/
>
> Thanks,
> Stewart
>
> On Aug 31, 5:03 pm, William <[email protected]> wrote:
>
> > On Aug 30, 5:33 pm, Stewart <[email protected]> wrote:
>
> > > I've got a sample application 
> > > here:http://bolidian.com/samples/gmapi/test.html
>
> > as an example, the above application has the following json fragment:
>
> > "start_location":{"b":-32.06027,"c":115.89242}
>
> > this represents a google.maps.LatLng object, so the parser will need
> > to use a
> > reviver function to recreate the objects by calling:
>
> > new google.maps.LatLng(lat,lng) with these parameters:
>
> > "start_location":{"lat":-32.06027,"lng":115.89242}
>
> > ...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to