class Object

def ffi_yajl(yajl_gen, state)

def ffi_yajl(yajl_gen, state)
  if !state[:processing_key] && respond_to?(:to_json)
    str = to_json(state[:json_opts])
    # #yajl_gen_number outputs a string without quotes around it
    status = FFI_Yajl.yajl_gen_number(yajl_gen, str, str.bytesize)
  else
    str = to_s
    status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize)
  end
  FFI_Yajl::Encoder.raise_error_for_status(status, str) if ( status ) != 0
end