http://qs321.pair.com?node_id=11137940

cnd has asked for the wisdom of the Perl Monks concerning the following question:

JSON::XS is not thread-safe (crashes mod_perl in production) and seems to have a memory leak (I see oob on apache after some time...)
All the other JSON's are stupidly slow.
JSON:XS (and all the others) are riddled with "croak" statements - making them unusable in production without wrapping them in "eval()".
eval makes JSON::XS even slower than JSON::PP

Philosophically - I strongly disagree with the concept of ever using "croak" on broken input - that's a fast-track way to derail production code... but that's just my opinion (based on a mere 37 years of programming every day).

The spec looks *really* simple: https://datatracker.ietf.org/doc/html/rfc8259 - with the exception of the unicode mess (which is the prime candidate for many of the croak deaths I observe above, and possibly the memory-leak.)

Is there any really-good C programmer here, who wants to engrave their name in history by writing a correct and stable JSON module, that can be safely used in scripts without any eval() needed ?

Suggestion: code some flags so that we users can specify the behaviour (in case some masochist actually wants to croak themselves), and other useful features (e.g. python interoperability including NaN, -inf, and other non-standard stuff that despite-not-being-standard everyone still wants/uses..., stripping of javascript-unsafe or broken unicode chars, pretty-printing, canonical output, ...)