Add util to handle 1 elem JSON arrays being converted to objects

(Also ran IntelliJ’s code reformatting)

This fixes a bug where a single element JSON array may be automatically converted to an object (apparently by the EAN API). [Here is a gist](https://gist.github.com/shakeelmohamed/005903e4cf5811532aba) showing the problem with both example JSON snippets

Take it away @bha & @ngrieble!
This is the key change. The rest of the deltas are refactoring