# File lib/multi_json/vendor/okjson.rb, line 73
    def valenc(x)
      case x
      when Hash    then objenc(x)
      when Array   then arrenc(x)
      when String  then strenc(x)
      when Numeric then numenc(x)
      when true    then "true"
      when false   then "false"
      when nil     then "null"
      else
        if x.respond_to?(:to_json)
          x.to_json
        else
          raise Error, "cannot encode #{x.class}: #{x.inspect}"
        end
      end
    end