Skip to main content
Version: v0.18.0

JSON

🚀 > JSON.parse('{"test": 123}')
=> {"test": 123.0}

Literal Specific Methods

parse(STRING)

Returns HASH

Takes a STRING and parses it to a HASH or ARRAY. Numbers are always FLOAT.

🚀 > JSON.parse('{"test": 123}')
=> {"test": 123.0}
🚀 > JSON.parse('["test", 123]')
=> ["test", 123.0]

Generic Literal Methods

methods()

Returns ARRAY

Returns an array of all supported methods names.

🚀 > "test".methods()
=> [count, downcase, find, reverse!, split, lines, upcase!, strip!, downcase!, size, plz_i, replace, reverse, strip, upcase]

to_json()

Returns STRING|ERROR

Returns the object as json notation.

🚀 > a = {"test": 1234}
=> {"test": 1234}
🚀 > a.to_json()
=> "{"test":1234}"

type()

Returns STRING

Returns the type of the object.

🚀 > "test".type()
=> "STRING"

wat()

Returns STRING

Returns the supported methods with usage information.

🚀 > true.wat()
=> BOOLEAN supports the following methods:
plz_s()