DeserializationException for 'Bool' type

I am encountering the following error message when writing to the ledger a specific data element

“JsonError: spray.json.DeserializationException: Can’t read “True” as TypePrim(PrimTypeBool,ImmArray.ImmArraySeq())”

This value is set as a Bool in DAML

Based on the documentation
https://docs.daml.com/daml/reference/data-types.html

Bool must be “True” or “False”

Any suggestions on what may be wrong ?

2 Likes

Afaik you need to send a JSON boolean i.e., true or false without any quotes. It sounds like you might be trying to send the string "True" which isn’t supported. The docs definitely need to be improved here.

2 Likes

This documentation page’s examples use the syntax you would use in DAML source code. This syntax is incompatible with JSON, so this document can’t be used by itself to write values in JSON API calls.

For specifying values as JSON, refer instead to the JSON encoding documentation. This includes what @cocreature already specified, as well as the proper JSON format for every other type of value in DAML.

3 Likes

Thanks. Solved the problem

1 Like