loop through complex json object javascript