I del with an API that sometimes gives me an item and sometimes an array of items for nearly all its endpoints. I generally turn the single results into arrays and then work form there in the rest of the app.

i.e. I would do this:

[code]
if(!isset($period['Paragraph'][0])) {
$t = $period['Paragraph'];
$period['Paragraph'] = array($t);
}
[/code]