Re: Default value for missing JSON fields

2019-01-02 Thread jegfish
Could you (or anyone else) please provide guidance as to what I could do to 
preserve an easy to use interface for users of my library?

Currently I have 2 ideas.

  * The first is to define types with the appropriate private fields for the 
JSON and defining exported getter procedures for people importing the module.
  * The other is to define custom procedures for converting the JSON to Nim 
objects.



Currently I am leaning towards the second because I think truly accessing 
fields feels better than replacing them with procedures, but I am not 
experienced enough in Nim or programming in general to know if there may be 
harmful effects of either possibility, or if there may be other options.


Re: Default value for missing JSON fields

2019-01-01 Thread dom96
Sadly you have to use an `Option` in this case. I'm afraid the to macro doesn't 
support anything else.