src/Serializer/JsonDeserializer.php
private function deserializeRuleGroup(array $decodedRuleGroup): RuleGroupInterface
    {
        if (!array_key_exists('condition', $decodedRuleGroup)) {
            throw new JsonDeserializerConditionException('Missing key condition in RuleGroup');
        }

        $not = false;
        if (
            array_key_exists('not', $decodedRuleGroup) &&
            true === $decodedRuleGroup['not']
        ) {
            $not = true;
        }

        $deserializedRuleGroup = new RuleGroup($decodedRuleGroup['condition'], $not);

        foreach ($decodedRuleGroup['rules'] as $ruleOrGroup) {
            if (array_key_exists('condition', $ruleOrGroup)) {
                $deserializedRuleGroup->addRuleGroup($this->deserializeRuleGroup($ruleOrGroup));
            } elseif (array_key_exists('id', $ruleOrGroup)) {
                $deserializedRuleGroup->addRule($this->deserializeRule($ruleOrGroup));
            }
        }

        return $deserializedRuleGroup;
    }
private function deserializeRuleGroup(array $decodedRuleGroup): RuleGroupInterface
    {
        if (!array_key_exists('condition', $decodedRuleGroup)) {
            throw new JsonDeserializerConditionException('Missing key condition in RuleGroup');
        }

        $not = false;
        if (
            array_key_exists('not', $decodedRuleGroup) &&
            true === $decodedRuleGroup['not']
        ) {
            $not = true;
        }

        $deserializedRuleGroup = new RuleGroup($decodedRuleGroup['condition'], $not);

        foreach ($decodedRuleGroup['rules'] as $ruleOrGroup) {
            if (array_key_exists('condition', $ruleOrGroup)) {
                $deserializedRuleGroup->addRuleGroup($this->deserializeRuleGroup($ruleOrGroup));
            } elseif (array_key_exists('id', $ruleOrGroup)) {
                $deserializedRuleGroup->addRule($this->deserializeRule($ruleOrGroup));
            }
        }

        return $deserializedRuleGroup;
    }
@param array $decodedRuleGroup

@return RuleGroupInterface