def decode(s)
    ts = lex(s)
    v, ts = textparse(ts)
    if ts.length > 0
      raise Error, 'trailing garbage'
    end
    v
  end
def decode(s)
    ts = lex(s)
    v, ts = textparse(ts)
    if ts.length > 0
      raise Error, 'trailing garbage'
    end
    v
  end
Decodes a json document in string s and
 returns the corresponding ruby value.
 String s must be valid UTF-8. If you have
 a string in some other encoding, convert
 it first.

 String values in the resulting structure
 will be UTF-8.