Parser ready
JSON.parse(s) parses JSON text into the Ruby value graph (Hash/Array/String/Integer/Float/true/false/nil), with symbolize_names to key hashes by Symbol, exactly as MRI’s parser does.
Ruby's JSON parser & generator in pure Go โ MRI-compatible, no cgo.
go-ruby-json is a pure-Go (no cgo) reimplementation of Ruby's JSON library โ a JSON.parse parser and a JSON.generate / JSON.pretty_generate generator that match reference Ruby's parsing and serialization byte-for-byte. It round-trips Ruby values through JSON the way MRI does: the full value graph (Hash/Array/String/Integer/Float/true/false/nil), symbolize_names, depth-limited nesting, and the complete JSON::ParserError / JSON::NestingError / JSON::GeneratorError taxonomy. It was extracted from rbgo's prelude/internals into a reusable standalone library: no dependency on the Ruby runtime, the dependency runs the other way. It is the JSON backend for go-embedded-ruby, bound by rbgo as a native module just like go-ruby-regexp and go-ruby-erb โ differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.
JSON.parse(s) parses JSON text into the Ruby value graph (Hash/Array/String/Integer/Float/true/false/nil), with symbolize_names to key hashes by Symbol, exactly as MRI’s parser does.
JSON.generate(v) emits compact JSON and JSON.pretty_generate(v) the indented form, matching reference Ruby’s spacing and escaping byte-for-byte.
Depth tracking that raises JSON::NestingError past the configured limit, mirroring MRI’s recursion guard on both parse and generate.
The JSON::ParserError / JSON::NestingError / JSON::GeneratorError hierarchy, raised on the same inputs and with the same messages as reference Ruby.
Integers, floats, and escapes (including \uXXXX surrogate pairs) parsed and emitted exactly as MRI, including the float formatting edge cases.
A wide corpus round-tripped here and by the system ruby/json, compared byte-for-byte; 100% coverage, gofmt + go vet clean, green across all six 64-bit Go arches and three OSes.
A faithful port of Ruby's JSON parser and generator in pure Go, cgo disabled, so it cross-compiles and embeds anywhere. It parses JSON into the Ruby value graph with symbolize_names, emits compact and pretty_generate forms, tracks nesting depth, and raises the JSON::ParserError / JSON::NestingError / JSON::GeneratorError taxonomy. Validated differentially against the system ruby binary โ parsed and generated values compared against MRI's json. It is a standalone, reusable module extracted from rbgo's internals, and the JSON backend for the sibling org github.com/go-embedded-ruby.