$ show treeform/jsony
JSONy is a high-performance JSON parsing and serialization library for the Nim programming language. It bypasses the intermediate JSON node step used by the standard library, directly converting between JSON strings and Nim data structures for improved speed and reduced garbage collection pressure. The library features a flexible hook system (newHook, postHook, parseHook, dumpHook, etc.) that allows customization of the serialization and deserialization process for complex scenarios like handling missing fields, renaming fields, processing enums, and working with JSON-in-json. It supports a wide range of Nim types including primitives, sequences, arrays, objects, ref objects, options, enums, tuples, sets, tables, and custom types via hooks. The implementation avoids StringStream overhead by working directly with memory buffers and parses numbers without intermediate string allocations.
The LLM identified 1 files worth highlighting for reuse:
Provides macros for handling object variants (discriminated unions) in Nim. Includes utilities to detect object variants, extract discriminator fields, and construct new variant instances. Self-contained with only a dependency on the Nim macros module, demonstrating advanced metaprogramming techniques that can be reused in any Nim project needing to work with sum types or tagged unions.