Class: PG::TextDecoder::JSON
- Inherits:
-
SimpleDecoder
- Object
- Coder
- SimpleCoder
- SimpleDecoder
- PG::TextDecoder::JSON
- Defined in:
- lib/pg/text_decoder/json.rb
Overview
This is a decoder class for conversion of PostgreSQL JSON/JSONB type to Ruby Hash, Array, String, Numeric, nil values.
As soon as this class is used, it requires the ruby standard library ‘json’.
Constant Summary
Constants inherited from Coder
Coder::FORMAT_ERROR_MASK, Coder::FORMAT_ERROR_TO_PARTIAL, Coder::FORMAT_ERROR_TO_RAISE, Coder::FORMAT_ERROR_TO_STRING, Coder::TIMESTAMP_APP_LOCAL, Coder::TIMESTAMP_APP_UTC, Coder::TIMESTAMP_DB_LOCAL, Coder::TIMESTAMP_DB_UTC
Instance Attribute Summary
Attributes inherited from Coder
Instance Method Summary collapse
Methods inherited from Coder
#==, #dup, #flags, #flags=, #format, #format=, #initialize, #inspect, #inspect_short, #marshal_dump, #marshal_load, #oid, #oid=, #to_h
Constructor Details
This class inherits a constructor from PG::Coder
Instance Method Details
#decode(string, tuple = nil, field = nil) ⇒ Object
12 13 14 |
# File 'lib/pg/text_decoder/json.rb', line 12 def decode(string, tuple=nil, field=nil) ::JSON.parse(string, quirks_mode: true) end |