How JSONy hooks work
masterHooks are the core concept of JSONy, allowing you to customize how JSON is parsed or serialized. To use a hook, you must export it (using *) to the scope where parsing/serialization occurs so the system can locate it.
Available hook types include:
newHook*(): Populate default values before full deserialization.postHook*(): Run code after an object is fully parsed (e.g., for sanitization or derived fields).enumHook*(): Map JSON strings to specific Nim enum variants.renameHook*(): Rename JSON field names at runtime (useful for reserved words liketype).parseHook*(): Override default parsing logic for any type (e.g., parsing date strings intoDateTime).dumpHook*(): Define custom serialization logic for a type.skipHook*(): Prevent specific fields from being serialized.