Add the ability to return non-nested responses

This functionality means we no longer need to use JavaScript on the client
side to flatten the data.

The code has been written so it should be relatively straightforward to strip
out the grouped/nested code in the future when Backdrop changes to only return
flattened responses.
This feels like a good opportunity for generative tests. Might be worth us having a chat with @philandstuff