'Decode a JSON document from ``s`` (a ``str`` or ``unicode``
beginning with a JSON document) and return a 2-tuple of the Python
representation and the index in ``s`` where the document ended.
This can be used to decode a JSON document from a string that may
have extraneous data at the end.'

def raw_decode(self, s, idx=0):

    try:
        (obj, end) = self.scan_once(s, idx)
    except StopIteration:
        raise ValueError('No    JSON    object    could    be    decoded')
    return (obj, end)
