Skip to content

v1.2.0 - The Hierarchy Update: Enhanced Decoder & Strict Parsing

Choose a tag to compare

@sbsagasbsaga released this 20 Dec 18:07
· 31 commits to main since this release
52e3957

🚀 Overview
Version 1.2.0 is a major logic update for the TOON package. This release focuses on "Lossless Data Integrity," ensuring that complex, deeply nested PHP structures can be converted to TOON and parsed back without any structural shifts or data leakage.

✨ Key Improvements

  1. Strict Indentation Guard
    We have introduced a new recursive scope manager in the ToonDecoder. This prevents "indentation drift" where values from a nested block could accidentally merge into the wrong parent key. The parser now strictly resets the scope based on leading spaces.

  2. Smart Object Pivoting
    The engine now intelligently detects when a list of objects is being parsed. If the decoder sees a repeating key (like id or order_id) at the same indentation level, it automatically pivots the parent container into a sequential array of objects.

  3. Precision Escaping
    Special character handling has been refined. Commas (,) and colons (:) within string values are now correctly escaped and unescaped, ensuring that names like "Sagar, Admin" or transaction IDs like "TXN:123" do not break the TOON structure.

  4. Optimized Tabular Rendering
    The items[N]{fields}: block logic is now more robust. It handles nested tables within associative keys much more reliably, significantly reducing token usage for AI prompts.

🛠 Internal Changes
Refactored finalizeTables: Cleaner recursive cleanup of internal table markers.

Improved Type Coercion: Better handling of null, boolean, and float types during decoding.