crystal-by-example
crystal-by-example copied to clipboard
Example JSON
result = String.build do |io| io.json_object do |object| object.field "address", "Crystal Road 1234" object.field "location" do io.json_array do |array| array << 12.3 array << 34.5 end end end end
Error: undefined method json_object for String::Builder
This doesn't seem to relevant anymore as the original example has been changed: https://github.com/askn/crystal-by-example/blob/aab909a613ba72c0b021d9d024e59a839a5122fd/json/json.cr#L13-L23