src/Debug/Output/Wamp.php
private function crateValues($values)
    {
        $prevIntK = null;
        $storeKeyOrder = false;
        foreach ($values as $k => $v) {
            if (!$storeKeyOrder && \is_int($k)) {
                if ($k < $prevIntK) {
                    $storeKeyOrder = true;
                }
                $prevIntK = $k;
            }
            if (\is_array($v)) {
                $values[$k] = self::crateValues($v);
            } elseif (\is_string($v) && !$this->debug->utf8->isUtf8($v)) {
                $values[$k] = '_b64_:'.\base64_encode($v);
            }
        }
        if ($storeKeyOrder) {
            $values['__debug_key_order__'] = \array_keys($values);
        }
        return $values;
    }
private function crateValues($values)
    {
        $prevIntK = null;
        $storeKeyOrder = false;
        foreach ($values as $k => $v) {
            if (!$storeKeyOrder && \is_int($k)) {
                if ($k < $prevIntK) {
                    $storeKeyOrder = true;
                }
                $prevIntK = $k;
            }
            if (\is_array($v)) {
                $values[$k] = self::crateValues($v);
            } elseif (\is_string($v) && !$this->debug->utf8->isUtf8($v)) {
                $values[$k] = '_b64_:'.\base64_encode($v);
            }
        }
        if ($storeKeyOrder) {
            $values['__debug_key_order__'] = \array_keys($values);
        }
        return $values;
    }
JSON doesn't handle binary well (at all)
a) strings with invalid utf-8 can't be json_encoded
b) "javascript has a unicode problem" / will munge strings
base64_encode all strings!

Associative arrays get JSON encoded to js objects...
Javascript doesn't maintain order for object properties
in practice this seems to only be an issue with int/numeric keys
store property order

@param array $values array structure

@return array