aeson-yaml: Output any Aeson value as YAML (pure Haskell library)

[ bsd3, json, library, text, web, yaml ] [ Propose Tags ]

This library exposes functions for encoding any Aeson value as YAML. There is also support for encoding multiple values into YAML "documents".

This library is pure Haskell, and does not depend on C FFI with libyaml. It is also licensed under the BSD3 license.

[Skip to Readme]
Versions [RSS] [faq],,,,,,,,
Change log
Dependencies aeson (>= && <1.6), aeson-yaml, base (>= && <5), bytestring (>= && <0.11), text (>=0.1 && <1.3), unordered-containers (>= && <0.3), vector (>=0.1 && <0.13) [details]
License BSD-3-Clause
Copyright 2019 Clovyr LLC
Author Patrick Nielsen
Revised Revision 3 made by patrick at 2020-05-25T18:48:51Z
Category Text, Web, JSON, YAML
Home page
Bug tracker
Source repo head: git clone
Uploaded by patrick at 2019-09-30T03:50:30Z
Distributions Arch:, Fedora:, LTSHaskell:, NixOS:, Stackage:
Executables json-to-yaml
Downloads 4656 total (277 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-09-30 [all 1 reports]


[Index] [Quick Jump]

Manual Flags


Build the binaries

Automatic Flags

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for aeson-yaml-

[back to package description]


BSD3-licensed library to encode any Aeson value as YAML, without a dependency on an external YAML library like yaml (libyaml C FFI) or HsYaml (GPL).


import qualified Data.Aeson.Yaml as Aeson.Yaml

Aeson.Yaml.encode :: ToJSON a => a -> LazyByteString

-- To encode multiple values, separated by '---' (YAML documents),
-- use `encodeDocuments`.
Aeson.Yaml.encodeDocuments :: ToJSON a => [a] -> LazyByteString

-- To encode values of different types, use `toJSON` from `Data.Aeson`
-- like so:
encodeDocuments [toJSON x, toJSON y, toJSON z]

See bin/JsonToYaml.hs for a simple command-line application using this library.