conditional check for relationship in json