Method: Oj::Parser#parse

Defined in:
ext/oj/parser.c

#parse(json) ⇒ Object

Parse a JSON string.

Returns the result according to the delegate of the parser.



1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'ext/oj/parser.c', line 1116

static VALUE parser_parse(VALUE self, VALUE json) {
    ojParser    p;
    const byte *ptr = (const byte *)StringValuePtr(json);

    TypedData_Get_Struct(self, struct _ojParser, &oj_parser_type, p);

    parser_reset(p);
    p->start(p);
    parse(p, ptr);

    return p->result(p);
}