ApiResult has a weird mess of functions that manipulate the internal data structure and data that manipulates an array that will later be added to the internal data structure, with some of the latter being dynamic for little good reason.
And then clean up of uses of all the deprecated functions, and ideally some unit tests to make sure things are more-or-less working right as far as the BC transformations and so on.
Since it all needs changing anyway, at the same time let's do the "Make ApiFormatXml not throw errors when it's missing its metadata" and "Create new formatversion for format=json" items from the API work planning document.