Method: Oj.safe_load
- Defined in:
- ext/oj/oj.c
.safe_load(doc) ⇒ Object
Loads a JSON document in strict mode with :auto_define and :symbol_keys turned off. This function should be safe to use with JSON received on an unprotected public interface.
-
doc [String_|IO] JSON String or IO to load.
Returns [Hash|Array|String|Fixnum|Bignum|BigDecimal|nil|True|False]
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 |
# File 'ext/oj/oj.c', line 891 static VALUE safe_load(VALUE self, VALUE doc) { struct _ParseInfo pi; VALUE args[1]; parse_info_init(&pi); pi.err_class = Qnil; pi.max_depth = 0; pi. = ; pi..auto_define = No; pi..sym_key = No; pi..mode = StrictMode; oj_set_strict_callbacks(&pi); *args = doc; return oj_pi_parse(1, args, &pi, 0, 0, 1); } |