I have looking for a way to encode the json keys, but has not been able to find anything on that.
For example Go lets us do this
}
I want to unmarshal a json object but not able to encode the json keys. As my key name start with number I am not able to have the same variable in json.
Latest Nim dev has custom pragmas that can be useful in this case.
Details at the bottom of https://github.com/nim-lang/Nim/blob/devel/doc/manual/pragmas.txt
Examples:
https://github.com/nim-lang/Nim/blob/devel/tests/pragmas/tcustom_pragma.nim
it could be not the only solution through
Nim offers similar functionality via the to macro, but indeed it doesn't support fields that begin with a number. I created an issue for this: https://github.com/nim-lang/Nim/issues/7139.
Depending on your JSON you may be able to use a combination of the approach I described above and the to macro.