Why json hooks doesn't work for CountTable[int]

2023-06-18 Thread z_____________
Looks like it's because std/jsonutils.toJsonHook for tables only accepts those with strings for keys. Converting the keys to strings when building the table should work: proc toJsonHook*[K](t: CountTable[K]): JsonNode = var t2: Table[string, int] for k, v in t: t

Why json hooks doesn't work for CountTable[int]

2023-06-18 Thread alexeypetrushin
The JSON serialisation hooks work for `CountTable[string]` but not for `CountTable[int]`, why?