instance method decode

Ruby on Rails 3.0.20

Since v2.3.18 Last seen in v3.0.20

Available in: v2.3.18 v3.0.20

Signature

decode(s)

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.

Parameters

s req
Source
# File activesupport/lib/active_support/json/backends/okjson.rb, line 45
    def decode(s)
      ts = lex(s)
      v, ts = textparse(ts)
      if ts.length > 0
        raise Error, 'trailing garbage'
      end
      v
    end

Defined in activesupport/lib/active_support/json/backends/okjson.rb line 45 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::OkJson

Type at least 2 characters to search.

↑↓ navigate · open · esc close