def read_json_double
      @context.read(@reader)
      num = 0
      if (@reader.peek == @@kJSONStringDelimiter)
        str = read_json_string(true)
        # Check for NaN, Infinity and -Infinity
        if (str == @@kThriftNan)
          num = (+1.0/0.0)/(+1.0/0.0)
        elsif (str == @@kThriftInfinity)
          num = +1.0/0.0
        elsif (str == @@kThriftNegativeInfinity)
          num = -1.0/0.0
        else
          if (!@context.escapeNum)
            # Raise exception -- we should not be in a string in this case
            raise ProtocolException.new(ProtocolException::INVALID_DATA, "Numeric data unexpectedly quoted")
          end
          begin
            num = Float(str)
          rescue
            raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
          end
        end
      else
        if (@context.escapeNum)
          # This will throw - we should have had a quote if escapeNum == true
          read_json_syntax_char(@@kJSONStringDelimiter)
        end
        str = read_json_numeric_chars
        begin
          num = Float(str)
        rescue
          raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
        end
      end
      return num
    end
def read_json_double
      @context.read(@reader)
      num = 0
      if (@reader.peek == @@kJSONStringDelimiter)
        str = read_json_string(true)
        # Check for NaN, Infinity and -Infinity
        if (str == @@kThriftNan)
          num = (+1.0/0.0)/(+1.0/0.0)
        elsif (str == @@kThriftInfinity)
          num = +1.0/0.0
        elsif (str == @@kThriftNegativeInfinity)
          num = -1.0/0.0
        else
          if (!@context.escapeNum)
            # Raise exception -- we should not be in a string in this case
            raise ProtocolException.new(ProtocolException::INVALID_DATA, "Numeric data unexpectedly quoted")
          end
          begin
            num = Float(str)
          rescue
            raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
          end
        end
      else
        if (@context.escapeNum)
          # This will throw - we should have had a quote if escapeNum == true
          read_json_syntax_char(@@kJSONStringDelimiter)
        end
        str = read_json_numeric_chars
        begin
          num = Float(str)
        rescue
          raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
        end
      end
      return num
    end
Reads a JSON number or string and interprets it as a double.