private static function replaceArrayByMap($json, array $arrayKeys)
    {
        preg_match_all(self::ARRAY_KEYS_REGEX, $json, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            if (!\in_array($match[1], $arrayKeys, true)) {
                $replace = str_replace('[]', '{}', $match[0]);
                $json = str_replace($match[0], $replace, $json);
            }
        }

        return $json;
    }