📜  如何将 json 转换为哈希 ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:45.535000             🧑  作者: Mango

代码示例1
response = Faraday.get('https://api.github.com/users/your_username')
r = JSON.parse(response.body, symbolize_names: true)
#OR
JSON.parse(response.body)
#'symbolize_names' turns the keys in this hash into symbols, not required
#JSON.parse is what turns the JSON object into a hash