Skip to content
Discussions/App Development/DeserializationException for 'Bool' typeForum ↗

DeserializationException for 'Bool' type

App Development4 posts419 views8 likesLast activity Jun 2020
BA
bartcantOP
Jun 2020

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 ?

CO
cocreature
Jun 2020

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.

ST
Stephen
Jun 2020
bartcant:

Based on the documentation
Reference: Data Types — Daml SDK 2.7.6 documentation

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.

BA
bartcant
Jun 2020

Thanks. Solved the problem

← Back to Discussions