Method: Iodine::JSON.parse!

Defined in:
ext/iodine/iodine_json.c

.parse!(*args) ⇒ Object

Parse a JSON string using the iodine lenient parser with a default Symbol rather than String key (this is often faster than the regular parse function).



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'ext/iodine/iodine_json.c', line 240

static VALUE iodine_json_parse_bang(int argc, VALUE *argv, VALUE self) {
  fiobj2rb_settings_s s = {.str2sym = 0};
  if (argc > 2)
    rb_raise(rb_eTypeError, "function requires supports up to two arguments.");
  if (argc == 2) {
    Check_Type(argv[1], T_HASH);
    iodine_json_update_settings(argv[1], &s);
  }
  if (argc >= 1)
    Check_Type(argv[0], T_STRING);
  else
    rb_raise(rb_eTypeError, "function requires at least one argument.");
  return iodine_json_convert(argv[0], s);
  (void)self;
}