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?
When we have a method that returns list of structs, depending on the element count we will get completely different results:
The question is why encode_handler_payload unwraps single-element lists?