Repaired getFriends for json cleaning and foreach