Method: Pathname#load_json
- Defined in:
- lib/pleasant_path/json/pathname.rb
#load_json(options = {}) ⇒ Object
Reads the file indicated by the Pathname, and parses the contents as JSON, deserializing arbitrary data types via type information embedded in the JSON. This is UNSAFE for JSON from an untrusted source. To consume untrusted JSON, use #read_json instead.
For information about options
, see JSON.parse
. By default, this method uses JSON.load_default_options
.
For information about serializing custom types to JSON, see the JSON readme.
52 53 54 |
# File 'lib/pleasant_path/json/pathname.rb', line 52 def load_json( = {}) JSON.load(self, nil, ) end |