Struct from JSON with extra data
examples/struct/struct_from_json_extra_data.cr
require "json" struct Person include JSON::Serializable getter name : String getter email : String end json_str = %[{ "name": "Bar", "email": "bar@foobar.com", "address" : "Somewhere" }] prs = Person.from_json(json_str) pp! prs p! prs.name
prs # => Person(@email="bar@foobar.com", @name="Bar") prs.name # => "Bar"