loop connections and match json