Re: JSON unmarshal with proc to()

2020-04-13 Thread wiremoons
Thanks very much for the help Yardanico, and for the example code. I was not aware of the `option` capability, which sounds like a great solution. I will give it a go in my program. Thanks for for the tip on `float` vs `float64` too :)

Re: JSON unmarshal with proc to()

2020-04-13 Thread Yardanico
If "alerts" might not exist, you need to wrap it in Option (see `options` module in stdlib) like WeatherForecast = ref object latitude: float64 longitude: float64 timezone: string currently: Currently daily: Daily alerts: Op

JSON unmarshal with proc to()

2020-04-13 Thread wiremoons
Hi I am after some advice please in the best way to handle a JSON unmarshal issue I have for a hobby project. I have been successfully using the Nim JSON unmarshal `proc to()` in my program to extract the elements I want to use from a JSON API output - which happens to be for weather forecast