Re: [go-nuts] Sending Json Data with different types

2020-01-18 Thread Dan Kortschak
Try something like this: https://play.golang.org/p/hcI8eMo08Wx Your array type needs to be an interface type to allow the different value types. On Sat, 2020-01-18 at 12:30 -0800, ramkill...@hotmail.com wrote: > I have a server that requires data to be sent back that looks like > this > >

Re: [go-nuts] Sending Json Data with different types

2020-01-18 Thread burak serdar
On Sat, Jan 18, 2020 at 10:28 PM wrote: > > I have a server that requires data to be sent back that looks like this > > {"jsonrpc": "2.0", "result": [false, "", "", ""], "id": 1} https://play.golang.org/p/WYrvolLytd9 Use a []interface{} for "result". > > Using json Encoder and Json

[go-nuts] Sending Json Data with different types

2020-01-18 Thread Ramkiller1
I have a server that requires data to be sent back that looks like this {"jsonrpc": "2.0", "result": [false, "", "", ""], "id": 1} Using json Encoder and Json Marshalling, the closes I have come up with is { "id": 1, "jsonrpc": "2.0", "result": "[false,\"\",\"\",\"\"]" } Is this