我在JSON中得到了一个响应,需要确保我在signal_events中只得到一个'信号'.我正在使用Ruby和rspec.
"signal_events": [ { "id": "587e9ae969702d10bd5a0000", "created_at": 1484692201, "geo": { "type": "Point", "coordinates": [ -153.45703125, 59.67773438 ] }, "expires_at": 1484778601, "geohashes": [ "bddg", "bdeh" ], "signal": { "id": "587e9ae969702d0911060000", "created_at": 1484692201.24, "expires_at": 1484778601.24, "signal_at": 1484691607, "source": "usgs", "updated_at": 1484692144, "magnitude": 2, "radius": 6.36107901750268, "event_name": "earthquake", "tsunami": "no" }, "signal_type": "earthquake", "centroid": { "type": "Point", "coordinates": [ -153.45703125, 59.67773438 ] }, "location": { "country": "United States", "country_code": "US", "city": "Kenai Peninsula Borough", "region": "Kenai Peninsula Borough", "region_code": "AK" } },
Andrey Deine.. 6
哈希不能包含重复的键,因此对于任何给定的键,您将始终拥有一个值.
哈希不能包含重复的键,因此对于任何给定的键,您将始终拥有一个值.