Note that there are some explanatory texts on larger screens.

plurals
  1. POmalformed JSON from Google directions API when calling from R
    primarykey
    data
    text
    <p>This might be a duplicate- but I couldn't find something to solve this problem.</p> <p>I'm using httpGET() to call the google directions API.</p> <p>Packages:</p> <pre><code>require(RCurl) require(rjson) require(gooJSON) </code></pre> <p>the code is:</p> <pre><code>url = "http://maps.googleapis.com/maps/api/directions/json?origin=12.9673293,77.7173975&amp;destination=12.9373613,77.700985&amp;waypoints=optimize:true|12.9723379,77.7117611|12.9922162,77.715895|12.9629354,77.7122996&amp;sensor=false" routeJSON = httpGET(url= url) routeList = fromJSON(routeJSON) </code></pre> <p>I get:</p> <pre><code>Error in fromJSON(routeJSON) : unexpected escaped character '\]' at pos 18 </code></pre> <p>I wrote the JSON to a file and copied it to jsoneditoronline.com. I got:</p> <pre><code>Error: Parse error on line 51: ... "points" : "qscnA_djyMj@kAT[\]\ -----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined' validated by jsonlint </code></pre> <p>But it works when I put the URL into the browser and copy the output to jsoneditoronline.</p> <p>Any idea why it is happening and/or how to circumvent it?</p> <p>EDIT: I tried gooJSON, but it seems it does not support the maps API V3.</p> <pre><code>&gt; goomap(url) $Status $Status$code [1] 610 $Status$request [1] "geocode" $Status$error_message [1] "The Geocoding API v2 has been turned down on September 9th, 2013. The Geocoding API v3 should be used now. Learn more at https://developers.google.com/maps/documentation/geocoding/" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload