Method: Oj.to_stream

Defined in:
ext/oj/oj.c

.to_stream(io, obj, options) ⇒ Object

Dumps an Object to the specified IO stream.

  • io [IO] IO stream to write the JSON document to

  • obj [Object] Object to serialize as an JSON document String

  • options [Hash] formating options

    • :indent [Fixnum] format expected

    • :circular [Boolean] allow circular references, default: false



1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
# File 'ext/oj/oj.c', line 1061

static VALUE
to_stream(int argc, VALUE *argv, VALUE self) {
    struct _Options	copts = oj_default_options;
    
    if (3 == argc) {
	oj_parse_options(argv[2], &copts);
    }
    oj_write_obj_to_stream(argv[1], *argv, &copts);

    return Qnil;
}