Ruby 从YELP API解析JSON时出错

Ruby 从YELP API解析JSON时出错,ruby,json,parsing,yelp,Ruby,Json,Parsing,Yelp,我在解析来自YelpAPI的JSON时遇到问题。JSON数据如下所示: { region: { span: { latitude_delta: 0, longitude_delta: 0 }, center: { latitude: 38.054117, longitude: -84.439002 } }, tot

我在解析来自YelpAPI的JSON时遇到问题。JSON数据如下所示:

{
    region: {
        span: {
            latitude_delta: 0,
            longitude_delta: 0
        },
        center: {
            latitude: 38.054117,
            longitude: -84.439002
        }
    },
    total: 23,
    businesses: [
        {
            is_claimed: false,
            rating: 5,
            mobile_url: "http://m.yelp.com/biz/vineyard-community-church-lexington",
            rating_img_url: "http://s3-media1.ak.yelpcdn.com/assets/2/www/img/f1def11e4e79/ico/stars/v1/stars_5.png",
            review_count: 2,
            name: "Vineyard Community Church",
            snippet_image_url: "http://s3-media4.ak.yelpcdn.com/photo/VoeMtbk7NRFi6diksSUtOQ/ms.jpg",
            rating_img_url_small: "http://s3-media1.ak.yelpcdn.com/assets/2/www/img/c7623205d5cd/ico/stars/v1/stars_small_5.png",
            url: "http://www.yelp.com/biz/vineyard-community-church-lexington",
            phone: "8592582300",
            snippet_text: "I have been a member of Vineyard Community Church since 2004. Here you will find a modern worship service with a full band, witty speakers who teach...",
            image_url: "http://s3-media3.ak.yelpcdn.com/bphoto/D71eikniuaHjdOC8DB6ziA/ms.jpg",
            categories: [
                [
                    "Churches",
                    "churches"
                ]
            ],
            display_phone: "+1-859-258-2300",
            rating_img_url_large: "http://s3-media3.ak.yelpcdn.com/assets/2/www/img/22affc4e6c38/ico/stars/v1/stars_large_5.png",
            id: "vineyard-community-church-lexington",
            is_closed: false,
            location: {
                city: "Lexington",
                display_address: [
                    "1881 Eastland Pwky",
                    "Lexington, KY 40505"
                ],
                geo_accuracy: 8,
                postal_code: "40505",
                country_code: "US",
                address: [
                    "1881 Eastland Pwky"
                ],
                coordinate: {
                    latitude: 38.054117,
                    longitude: -84.439002
                },
                state_code: "KY"
            }
        }
    ]
}
{
    "region": {
        "span": {
            "latitude_delta": 0,
            "longitude_delta": 0
        },
        "center": {
            "latitude": 38.054117,
            "longitude": -84.439002
        }
    },
    "total": 23,
    "businesses": [
        {
            "is_claimed": false,
            "rating": 5,
            "mobile_url": "http://m.yelp.com/biz/vineyard-community-church-lexington",
            "rating_img_url": "http://s3-media1.ak.yelpcdn.com/assets/2/www/img/f1def11e4e79/ico/stars/v1/stars_5.png",
            "review_count": 2,
            "name": "Vineyard Community Church",
            "snippet_image_url": "http://s3-media4.ak.yelpcdn.com/photo/VoeMtbk7NRFi6diksSUtOQ/ms.jpg",
            "rating_img_url_small": "http://s3-media1.ak.yelpcdn.com/assets/2/www/img/c7623205d5cd/ico/stars/v1/stars_small_5.png",
            "url": "http://www.yelp.com/biz/vineyard-community-church-lexington",
            "phone": "8592582300",
            "snippet_text": "I have been a member of Vineyard Community Church since 2004. Here you will find a modern worship service with a full band, witty speakers who teach...",
            "image_url": "http://s3-media3.ak.yelpcdn.com/bphoto/D71eikniuaHjdOC8DB6ziA/ms.jpg",
            "categories": [
                [
                    "Churches",
                    "churches"
                ]
            ],
            "display_phone": "+1-859-258-2300",
            "rating_img_url_large": "http://s3-media3.ak.yelpcdn.com/assets/2/www/img/22affc4e6c38/ico/stars/v1/stars_large_5.png",
            "id": "vineyard-community-church-lexington",
            "is_closed": false,
            "location": {
                "city": "Lexington",
                "display_address": [
                    "1881 Eastland Pwky",
                    "Lexington, KY 40505"
                ],
                "geo_accuracy": 8,
                "postal_code": "40505",
                "country_code": "US",
                "address": [
                    "1881 Eastland Pwky"
                ],
                "coordinate": {
                    "latitude": 38.054117,
                    "longitude": -84.439002
                },
                "state_code": "KY"
            }
        }
    ]
}
JSON存储在名为@stuff的ruby字符串中 下面是我用来尝试和解析它的代码:

@parsed_stuff = JSON::parse(@stuff)
当我这样做并尝试显示@parsed_stuff的内容时,我在浏览器中遇到以下错误

Parse error on line 2: { "region"=>{ "span -------------^ Expecting '}', ':', ',', ']'
在此问题上提供的任何帮助都将不胜感激。

用于验证JSON。在这里,您必须将所有键作为字符串提供

试试看