hi all,

thanks for your insights. The Value interface{}  type does work nicely.

I had tried as well the map[string]interface{} route, and it works as well, 
so now I have two solutions which is kind of a luxury position.

Regards,
Natxo


On Thursday, June 3, 2021 at 7:41:21 AM UTC+2 Amnon wrote:

> No, whoever designed the schema of this API has lost their marbles,
> (or lacks any kind of consideration for the unfortunate souls who need to 
> use this API).
>
> Unmarshalling a value whose type is not fixed is a pain in Go.
> But handling a value of unknown type will be a headache in any language.
>
>
>
> On Wednesday, 2 June 2021 at 19:55:40 UTC+1 rob...@glonek.co.uk wrote:
>
>> I think I'm loosing my marbles. Nevermind what I said.
>>
>> On Wednesday, 2 June 2021 at 16:22:34 UTC+1 Brian Candler wrote:
>>
>>> > If you try using switch value.(type) instead of using reflect, bool 
>>> will be reported as int, fyi, so using reflect here.
>>>
>>> Could you explain that a bit further please?  A type switch seems to 
>>> work OK for me, with no reflect.
>>> https://play.golang.org/p/TBH5zKYnG4G
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e527006a-23d7-4139-abb0-0754531beb9cn%40googlegroups.com.

Reply via email to