Reconstructs values from event streams.
Provides functions to build complete value trees from parse events, enabling reconstruction of the original data structure after streaming decode.
Reconstructs values from event streams. Provides functions to build complete value trees from parse events, enabling reconstruction of the original data structure after streaming decode.
(events->value events)Reconstruct value from event stream.
Takes a sequence of parse events (from decode-stream-sync or decode-stream) and reconstructs the original data structure.
Parameters:
Returns: Reconstructed value (map, vector, or primitive)
Example: (let [events [{:type :start-object} {:type :key :key "name"} {:type :primitive :value "Alice"} {:type :key :key "age"} {:type :primitive :value 30} {:type :end-object}]] (events->value events)) ;=> {"name" "Alice", "age" 30}
Throws:
Reconstruct value from event stream.
Takes a sequence of parse events (from decode-stream-sync or decode-stream)
and reconstructs the original data structure.
Parameters:
- events: Sequence or iterable of parse events
Returns:
Reconstructed value (map, vector, or primitive)
Example:
(let [events [{:type :start-object}
{:type :key :key "name"}
{:type :primitive :value "Alice"}
{:type :key :key "age"}
{:type :primitive :value 30}
{:type :end-object}]]
(events->value events))
;=> {"name" "Alice", "age" 30}
Throws:
- ex-info on malformed event streams (unmatched brackets, missing keys, etc.)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |