Liking cljdoc? Tell your friends :D

exoscale/clj-yaml provides YAML encoding and decoding for Clojure via the snakeyaml Java library.

Build Status

(This is a maintained fork of the original).

Usage

(require '[clj-yaml.core :as yaml])

(yaml/generate-string
  [{:name "John Smith", :age 33}
   {:name "Mary Smith", :age 27}])
"- {name: John Smith, age: 33}\n- {name: Mary Smith, age: 27}\n"

(yaml/parse-string "
- {name: John Smith, age: 33}
- name: Mary Smith
  age: 27
")
=> ({:name "John Smith", :age 33}
    {:name "Mary Smith", :age 27})

By default, keys are converted to clojure keywords. To prevent this, add :keywords false parameters to the parse-string function:

(yaml/parse-string "
- {name: John Smith}
" :keywords false)

Installation

exoscale/clj-yaml is available as a Maven artifact from Clojars:

    [[exoscale/clj-yaml "0.5.6"]]

## Development

    $ git clone git://github.com/exoscale/clj-yaml.git
    $ lein deps
    $ lein test
    $ lein install

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close