module RbJSON5
[JSON5](json5.org/) parser for Ruby
Constants
- VERSION
Current version of
RbJSON5
Public Class Methods
load_file(filename, symbolize_names: false)
click to toggle source
Reads a JSON5 string from the given file and parses it into its Ruby data structure
@param filename [String]
name of the given file
@param symbolize_names [Boolean]
If set to true, converts names (keys) in a JSON5 object into Symbol
@return [Object]
Ruby data structure represented by the input
@see RbJSON5.parse
# File lib/rb_json5.rb, line 43 def self.load_file(filename, symbolize_names: false) File.open(filename, 'r') { |io| parse(io, symbolize_names: symbolize_names) } end
parse(string_or_io, symbolize_names: false)
click to toggle source
Parses a JSON5 string into its Ruby data structure
@param string_or_io [String, read]
JSON5 string itself or object like IO containing JSON5 string
@param symbolize_names [Boolean]
If set to true, converts names (keys) in a JSON5 object into Symbol
@return [Object]
Ruby data structure represented by the input
@see RbJSON5.load_file
# File lib/rb_json5.rb, line 29 def self.parse(string_or_io, symbolize_names: false) Parser.new.parse(string_or_io, symbolize_names) end