We can decode JSON data from a file on disk or, more broadly, any io.Reader, like a network connection.

The following example reads the file and decodes the content:

https://codeeval.dev/gist/d2d3c04db6ff36b41cb6be224fe6885f

By writing a helper function decodeFromReader, we can easily write wrappers that will work on files, strings or network connections.