是否可以将 HTTParty 请求结果作为对象使用
我想知道是否可以将 HTTParty 请求结果作为对象使用。
目前我使用字符串键来访问结果的值: result["imageurl"]
或 result["address"]["street"]
如果我在 JavaScript 中,我可以简单地使用: result.imageurl
或 result.address.street
I wonder if it possible to work with HTTParty request results as an object.
Currently I use string keys to access to values of result: result["imageurl"]
or result["address"]["street"]
If i were in JavaScript I could simply use: result.imageurl
or result.address.street
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 hashie gem 的
Mash
类。Use the
Mash
class of the hashie gem.我写了 这个辅助类几天前:
使用示例:
I wrote this helper class a few days ago:
Usage example: