Skip to content
CCPEDIAby Unity Nodes
App Development

DeserializationException for 'Bool' type

4 posts441 views8 likesLast activity Jun 2020

  1. bartcantOP 2

    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. cocreature 2

    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.

  3. Stephen 3
    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.

  4. bartcant 1

    Thanks. Solved the problem