Add JSON encoding to reader, and document it.