edn
Jump to function (4) ›
edn/read-string#
(read-string s)
(read-string s opts)
Reads one EDN value from string s.
When s is empty or only whitespace/comments, returns the :eof value
from opts (default nil).
Options: :readers map of tag (symbol, keyword, or string) to 1-arg handler fn :eof value returned for empty input
Example:
(read-string "{:a 1 :b 2}") ; => {:a 1, :b 2}
(read-string "" {:eof :default}) ; => :default
edn/read-string-all#
(read-string-all s)
(read-string-all s opts)
Reads every EDN value from string s and returns them as a vector.
Options: :readers map of tag (symbol, keyword, or string) to 1-arg handler fn
Example:
(read-string-all "1 2 3") ; => [1 2 3]
edn/write-string#
(write-string value)
Serialises value to its EDN string representation. Uses Phel's readable printer so the output round-trips through read-string for all EDN-compatible values (nil, booleans, numbers, strings, keywords, symbols, lists, vectors, maps, sets, and built-in tagged literals such as #uuid).
Example:
(write-string {:a 1}) ; => "{:a 1}"
edn/write-string-all#
(write-string-all xs)
Serialises a sequence of values to EDN, separating top-level forms with a single space. Inverse of read-string-all.
Example:
(write-string-all [1 2 3]) ; => "1 2 3"
(write-string-all [1 "hi" :kw]) ; => "1 \"hi\" :kw"