enhanced the json writer function
This commit is contained in:
parent
4cbcc38308
commit
a7cbda7208
@ -1120,8 +1120,12 @@ int mio_jsonwr_write (mio_jsonwr_t* jsonwr, mio_json_inst_t inst, int is_uchars,
|
||||
!(sn->state == MIO_JSON_STATE_IN_OBJECT && sn->obj_awaiting_val)) goto incompatible_inst;
|
||||
if (sn->index > 0) WRITE_COMMA (jsonwr);
|
||||
sn->index++;
|
||||
if ((jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) &&
|
||||
!(sn->state == MIO_JSON_STATE_IN_OBJECT && sn->obj_awaiting_val))
|
||||
{
|
||||
WRITE_INDENT (jsonwr);
|
||||
}
|
||||
sn->obj_awaiting_val = 0;
|
||||
if (jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) WRITE_INDENT (jsonwr);
|
||||
WRITE_BYTES_NOESC (jsonwr, "[", 1);
|
||||
if (jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) WRITE_LINE_BREAK (jsonwr);
|
||||
if (push_write_state(jsonwr, MIO_JSON_STATE_IN_ARRAY) <= -1) return -1;
|
||||
@ -1133,8 +1137,12 @@ int mio_jsonwr_write (mio_jsonwr_t* jsonwr, mio_json_inst_t inst, int is_uchars,
|
||||
!(sn->state == MIO_JSON_STATE_IN_OBJECT && sn->obj_awaiting_val)) goto incompatible_inst;
|
||||
if (sn->index > 0) WRITE_COMMA (jsonwr);
|
||||
sn->index++;
|
||||
if ((jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) &&
|
||||
!(sn->state == MIO_JSON_STATE_IN_OBJECT && sn->obj_awaiting_val))
|
||||
{
|
||||
WRITE_INDENT (jsonwr);
|
||||
}
|
||||
sn->obj_awaiting_val = 0;
|
||||
if (jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) WRITE_INDENT (jsonwr);
|
||||
WRITE_BYTES_NOESC (jsonwr, "{", 1);
|
||||
if (jsonwr->flags & MIO_JSONWR_FLAG_PRETTY) WRITE_LINE_BREAK (jsonwr);
|
||||
if (push_write_state (jsonwr, MIO_JSON_STATE_IN_OBJECT) <= -1) return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user