Hi, my custom data type contains `times.DateTime`:
    
    
    import options, tables, times
    import deser_json
    type
        Data* = object
            shifts*: OrderedTable[int64, Shift]
            balance*: float
        
        Shift* = object
            quoted*: bool
            date*: DateTime
            description*: string
            start*: Option[DateTime]
            finish*: Option[DateTime]
            breakTime*: Option[Duration]
            rate*: float
            qty: Option[float]
            id*: int64
    
    let shift = Shift(
        quoted: true,
        date: parse("2000-01-01", "yyyy-MM-dd"),
        description: "abcdef",
        start: none(DateTime),
        finish: none(DateTime),
        breakTime: none(Duration),
        rate: 462.11,
        qty: some(10.0),
        id: getTime().toUnix()
    )
    
    var shifts: OrderedTable[int64, Shift]
    shifts[shift.id] = shift
    
    let data = Data(
        shifts: shifts,
        balance: 0.00
    )
    
    assert data == data.dumps().parse().to(Data)
    
    
    Run

When I try to serialize/deserialize my type I get the following error:
    
    
    /home/adnan338/.choosenim/toolchains/nim-1.4.2/lib/pure/times.nim(2110, 39) 
Hint: 'parse' cannot raise 'Defect' [XCannotRaiseY]
    /tmp/serde.nim(39, 8) template/generic instantiation of `assert` from here
    /home/adnan338/.nimble/pkgs/deser_json-0.2.1/deser_json.nim(341, 8) 
template/generic instantiation of `dumps` from here
    /home/adnan338/.nimble/pkgs/deser_json-0.2.1/deser_json.nim(296, 17) 
template/generic instantiation of `forSerFields` from here
    /home/adnan338/.nimble/pkgs/deser-0.1.4/deser/templates.nim(8, 15) Error: 
attempting to call undeclared routine: 'hasCustomPragma'
    
    
    Run

I was using `deserjson` in this code, I also tried 
[nimyaml](https://nimyaml.org/) and 
[serializetools](https://github.com/JeffersonLab/serializetools/blob/master/serializetools/serializebin.nim)
 and they also failed for different reasons. What package should supoort my 
data type?

Reply via email to