I'm using Laravel 4 Response::json function and having trouble with passing an object. I have an object of User, containing some other objects - Account and Settings. I tried to cast the object to array, but the internal objects (Account and Settings) stay as object. Is there an easy way to convert a nested object to array so I can pass it on to Response::json?