I isolated strange case where error message why it can't convert to JSON is very misleading.
Please try code online to see it, click the "Run" button <https://repl.it/@alexeypetrushin/jsonerror#main.nim> Nim complained that `State` can't be converted to JSON when in reality the problem was that `proc save*(c: Container): void` wad declared without specifying generic parameter for Container as `proc save*(c: Container[string]): void`. Not sure if it's a bug or maybe I'm missing something.