ext/iodine/fiobj_json.c
/**
 * Parses JSON, setting `pobj` to point to the new Object.
 *
 * Returns the number of bytes consumed. On Error, 0 is returned and no data is
 * consumed.
 */
Parses JSON, setting `pobj` to point to the new Object.
Returns the number of bytes consumed. On Error, 0 is returned and no data is
consumed.
Parses JSON setting ` pobj ` to point to the new Object . Returns the number of bytes consumed . On Error 0 is returned and no data is consumed .
size_t fiobj_json2obj(FIOBJ *pobj, const void *data, size_t len) {
  fiobj_json_parser_s p = {.top = FIOBJ_INVALID};
  size_t consumed = fio_json_parse(&p.p, data, len);
  if (!consumed || p.p.depth) {
    fiobj_free(fio_json_stack_get(&p.stack, 0));
    p.top = FIOBJ_INVALID;
  }
  fio_json_stack_free(&p.stack);
  fiobj_free(p.key);
  *pobj = p.top;
  return consumed;
}
size_t fiobj_json2obj ( FIOBJ * pobj , const void * data , size_t len ) { fiobj_json_parser_s p = { . top = FIOBJ_INVALID } ; size_t consumed = fio_json_parse ( & p . p , data , len ) ; if ( ! consumed || p . p . depth ) { fiobj_free ( fio_json_stack_get ( & p . stack , 0 ) ) ; p . top = FIOBJ_INVALID ; } fio_json_stack_free ( & p . stack ) ; fiobj_free ( p . key ) ; * pobj = p . top ; return consumed ; }
Parses JSON, setting `pobj` to point to the new Object.
Parses JSON setting ` pobj ` to point to the new Object .