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

nested association lists were not converted to maps #48

Closed semio closed 6 years ago

semio commented 6 years ago

dhall-to-json doesn't work when we supply an association list where the mapValue itself is an association list. For example

[ { mapKey = "somekey", mapValue = [ { mapKey = "\$gt", mapValue = 100 } ] } ]

was converted to

{
  "somekey": [
    {
      "mapKey": "$gt",
      "mapValue": 100
    }
  ]
}

but I guess the expected output should be:

{
  "somekey": {
    "$gt": 100
  }
}

Is it possible to make the conversion recursive so that it would generate the expected result? I am new to dhall (and Haskell) so please correct me if I am wrong.

Gabriella439 commented 6 years ago

@semio: Yes, this is fixable to behave the way you expect. Let me take a stab at it