JSON to NamedTuple
- NamedTuple
- from_json
- JSON
require "json"
alias Thing = NamedTuple(name: String, number: Int32)
thing_json = %{{"name": "table", "number": 3}}
puts thing_json
tg = Thing.from_json(thing_json)
puts tg
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
require "json"
alias Thing = NamedTuple(name: String, number: Int32)
thing_json = %{{"name": "table", "number": 3}}
puts thing_json
tg = Thing.from_json(thing_json)
puts tg