public static function fromString(string $input, string $locale): Resource
    {
        $data = json_decode($input, true);
        if (json_last_error() !== \JSON_ERROR_NONE) {
            if (function_exists('json_last_error_msg')) {
                throw new \InvalidArgumentException(json_last_error_msg(), json_last_error());
            }
            throw new \InvalidArgumentException("Error parsing JSON.", json_last_error());
        }

        return static::fromArray($data, $locale);
    }