Hi all
I defined my own type, lets name it A, and created table :
var dictionary = new_table[A, Hash_set[A]]()
Now i want serialize this data, but failed to do this, currently. I tried json module, but, as spec says, Json cant represent complex types as keys in dictionaries. So I felt back on marshal module, which, actually, creates json from my table, but when I try compile code with deserialization:
var unmarshalled = read_file("marshalled.json").to[typeof(dictionary)]
it throws
/lib/marshal.nim(317,10) Error: cannot instantiate : 'T'
What can i do, to serialize this structure?
My nim compiler version is 1.0.6
Thank you for the answer, it works! But deserialization throws runtime exception :(
/usr/lib/nim/pure/marshal.nim (333) to
/usr/lib/nim/pure/marshal.nim (266) loadAny
/usr/lib/nim/pure/marshal.nim (179) loadAny
/usr/lib/nim/pure/parsejson.nim (522) raiseParseErr
Error: unhandled exception: unknown file(1,1) Error: '{' expected for an object expected [JsonParsingError]
But why?... '{' in place