ip2location response is multidimentional object that needs to be converted to array. Type casting the response to array will not solve this.