Refactor messages/json_messages out of io

Move these two non-io related methods to __init__. Since they aren't
strictly related to the handling of io, like `io.lines` is. They can be
moved to a more specific module later - which will probably look more like a
"chain".