What steps will reproduce the problem?
1. Create an api key or use the attached download file and generate a Google
Places result. example:
https://maps.googleapis.com/maps/api/place/details/json?extensions&reference=CoQ
BcwAAAGUXL9IN3925iac5iG8il1Facl__usLd6e3PPV7jQyxbZTVyl0nGNQRw5WpF-i1AGhQNJ44WiVG
f7jxBVcU57bXWSWBYkd-Dz6DImh2SRJX4hvb8eXAMJm2ec7-d0F7QLWWY3xJcNw_PH5PgeMOB_BhRIjg
t49q2CFHCZlQUjj6sEhBz7Dj_32jVa0fkNtBJiOI6GhT6RKUr9TLWaXoLrRI5UmQakozLiQg&sensor=
true&key=AddYourOwnKeyHere
or use the sample json provided by Google at:
https://developers.google.com/places/documentation/details
PS, I'm not supposed to keep a copy of the json file according to the agreement
with Google but the error output does copy the original text.
2. attempt to use this source file as your json in a command like:
jsonpath $..website PlaceDetailsExtensionsResult.json >>output.txt 2>&1
or something like
require 'uri'
require 'net/http'
require 'rspec'
require 'jsonpath'
$uri = URI.parse("https://maps.googleapis.com")
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
def fetch(uri_str, limit)
raise ArgumentError, 'This application does not allow redirects' if limit == 0
response = Net::HTTP.get_response($uri + uri_str)
case response
when Net::HTTPSuccess then
#Net::HTTP.get_print($uri + uri_str)
response
when Net::HTTPRedirection then
location = response['location']
newLocation = location.gsub(Regexp.new(Regexp.escape($uri.to_s)),'')
warn "redirected to #{location}"
fetch(newLocation, limit - 1)
else
response.value
end
end
json_call = 'maps/api/place/nearbysearch/json?key=AIzaSyCzh625_u4LOd3LcOOIyqiE3uBMfso48cg&sensor=false&location=53.541195,-113.490331&radius=200&types=bakery|bar|cafe|night_club|bar|restaurant'
json = fetch(json_call,1).body
JsonPath.on(json, '$..reference')
3. Receive an error about invalid json... which is technically correct against
RFC 4627. However, the JSON input is valid in JavaScript.... check it out at
http://www.freeformatter.com/json-validator.html.
What is the expected output? What do you see instead?
Need to be able to use the Javascript form of valid JSON, especially since such
major backers as Google are taking shortcuts.
What version of the product are you using? On what operating system?
The Ruby implementation on Windows, Ruby 2.0.0, json-1.8.0
Please provide any additional information below.
The issue seems to be the difference between requiring a value with quotes
within in a blank entry. I'm still looking for anything that would
automatically reformat it from the Javascript version to the standard
Original issue reported on code.google.com by jam....@gmail.com on 13 Sep 2013 at 7:44
Original issue reported on code.google.com by
jam....@gmail.com
on 13 Sep 2013 at 7:44Attachments: