Skip to content

Instantly share code, notes, and snippets.

@mlomnicki
Created January 28, 2016 14:50
Show Gist options
  • Save mlomnicki/2f2accf96755a0a6eee9 to your computer and use it in GitHub Desktop.
Save mlomnicki/2f2accf96755a0a6eee9 to your computer and use it in GitHub Desktop.
JSON + OpenStruct
require 'json'
require 'ostruct'
data = '{"a": {"b": 1}}'
result = JSON.parse(data, object_class: OpenStruct)
result.a.b # => 1
@KamilLelonek
Copy link

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment