Skip to content

Return single element array with JSON-RPC is impossible? #422

@cl0ne

Description

@cl0ne

When we have a method that returns list of structs, depending on the element count we will get completely different results:

  • list with 2+ structs will give an expected array with 2+ objects;
  • empty list will give an empty string (okay, I get it, we have no way differentiate empty list from empty strings);
  • list with single struct will be stripped down to object instead of an array with single object (of course, we can work around this by wrapping result list with a single-field object, but that looks like an ugly hack).

The question is why encode_handler_payload unwraps single-element lists?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions