Write to file expects an array, not an actual stdClass