dhall-lang / dhall-json

This repository has moved to https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
BSD 3-Clause "New" or "Revised" License
65 stars 6 forks source link

Convert certain association lists to JSON records #29

Closed Gabriella439 closed 6 years ago

Gabriella439 commented 6 years ago

Fixes #27

This adds support for converting Dhall lists of the form:

List { mapKey : Text, mapValue : v }

... to JSON records. For example, this Dhall association list:

[ { mapKey = "foo", mapValue = 1 }
, { mapKey = "bar", mapValue = 2 }
]

... converts to this JSON record:

{ "foo": 1
, "bar": 2
}

This functionality can be customized via the command line API. For example, you can use --noMaps to disable this entirely or you can use the --key and --value options to rename the expected fields for the association list.