I didn’t even think of types that are printed with calls. Those are unlikely to be as malicious as JSON injection, but side effects and call overheads are not desirable during parsing either. Ultimately, I don’t think it’s worth trying to fix the security issues for the general case. The printed types/stored strings weren’t precise enough to specify a structure to begin with, and when you’re already depending on your specific module and environment, you won’t store inconveniently printed type names or write malicious JSON. Might just have to document the pitfalls and restrict it to isolated internal use; same goes for eval and deserialization.