added convert arrays to json object function