Hello all,

I'm busy trying to import a JSON coming from Google Latitude such as:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    3.843055,
                    50.423265
                ]
            },
            "properties": {
                "id": "12345678901234567890",
                "accuracyInMeters": 6,
                "timeStamp": 1304722925,
                "reverseGeocode": "Colfontaine, Belgium",
                "photoUrl": "https://www.google.com/latitude/apps/badge/api?type=photo&photo=OiK8yC8BAAA.tpzqqq4myWz-tE1t7EpXjQ.AiBLZAWpj_NnMUR26nmTDg",
                "photoWidth": 96,
                "photoHeight": 96,
                "placardUrl": "https://www.google.com/latitude/apps/badge/api?type=photo_placard&photo=OiK8yC8BAAA.tpzqqq4myWz-tE1t7EpXjQ.AiBLZAWpj_NnMUR26nmTDg&moving=false&stale=true&lod=1&format=png",
                "placardWidth": 56,
                "placardHeight": 59
            }
        }
    ]
}

If I use JSONpath 0.8.1 and context $.features.* It's impossible to get the right coordinates using geometry.coordinates.[0] and geometry.coordinates.[1] because of this bug.

This is a known error on JSONpath, so that's why I advice you to use the r47 (or newer) of the library (known as JSONpath 0.8.3), not released as stable version but in trunk.

You can find it here: http://code.google.com/p/jsonpath/source/browse/trunk/src/php/jsonpath.php

I'm currently using it and it's really better, maybe we should post a note on the module homepage ?

Comments

mgifford’s picture

Wow, and that's from Sep 19, 2007. Thanks!

milesw’s picture

I ran into this same bug trying to work with GeoJSON (which is the format the OP was getting from Google Latitude). Using the JSONpath 0.8.3 solved the issue for me as well.

twistor’s picture

Assigned: Pol » Unassigned
Priority: Major » Normal
Status: Active » Fixed

This module has accepted arbitrary versions of the JSONPath for quite some time.

I just updated the main page to download the the truck version.

Pol’s picture

Amazing ! \o/

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.