·
1 commit
to main
since this release
What's New
ToJson Protocol
Custom serialization support via the ToJson protocol:
(defrecord Person [first-name last-name]
ToJson
(-to-json [_]
{:name (str first-name " " last-name)}))
(toon/encode (->Person "Alice" "Smith"))
;; => "name: Alice Smith"Replacer Function
Transform values during encoding with a replacer function:
(toon/encode data {:replacer (fn [k v] (if (= k "password") "***" v))})Path Expansion with Quoted Keys
Path expansion now correctly tracks and quotes keys that require quoting.
JSON-like Numeric Grammar
- Leading zeros now rejected (
007,-007→ treated as strings) - Scientific notation supported (
1e10,1E-5,2.5e+3)
Bare List Marker Support
Bare list markers (- alone) now decode to empty objects {}:
[2]:
-
- name: Ada
Decodes to: [{} {"name" "Ada"}]
V3.0 Spec: List-Item Tabular Arrays
Enhanced encoding for arrays of objects within list items.
Commits
- feat(encode): add ToJson protocol for custom serialization
- feat(encode): add replacer function for value transformation
- feat(decode): add quoted key tracking for path expansion
- feat(encode): add v3.0 spec list-item tabular array encoding
- fix(decode): enforce JSON-like numeric grammar with scientific notation
- fix(decode): handle bare list marker as empty object