Skip to content

Clarification of decoder behaviour #17

@mfridman

Description

@mfridman

In the examples, GreetRequest is a simple struct with a single Name field. I was expecting to send the request as an object

{ "name": "mike" }

But I get the error:

decode json: json: cannot unmarshal object into Go value of type []*simplyProjected.SimpleRequest

If I send it as an array its fine. Is the expected behaviour of the decoder to assume an array of objects?

[{ "name": "mike" }]

https://github.com/machinebox/remoto/blob/master/examples/greeter/server/greeter/server.go#L90

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions