Read a single line and decode it as JSON.

        Can raise an EOFError() when the input source was closed.

def read_json(self):
        """Read a single line and decode it as JSON.

        Can raise an EOFError() when the input source was closed.

        """
        line = self.stdin.readline()
        if line == '':
            raise EOFError()
        return json.loads(line)