Skip to content

Commit c31a4e9

Browse files
author
root
committed
tjson.c
1 parent d9d43b2 commit c31a4e9

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

BasicLib/Lib/tjson.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ tJson* _json_array_parse(tJson* json, int num)
366366
367367
JSONデータの 配列ノードの値(配列データ)を処理する.
368368
369-
@param json 処理を行う JSON ノードデータ.
370-
@param num 処理の残り段数
369+
@param json 配列処理を行う JSON ノードデータ.
370+
@param num 配列処理の残り段数
371371
@return 処理された JSON ノードデータ.
372372
*/
373373
tJson* _json_array_parse(tJson* json, int num)
@@ -392,8 +392,8 @@ JSONデータの 配列ノードの値(配列データ)を処理する.@n
392392
393393
@param json JSON ノードデータ.NULLでない場合は,このデータの後に結果が付加される.@n
394394
NULLでも可.
395-
@param pp 処理を行うデータ
396-
@param num 処理の残り段数
395+
@param pp 配列処理を行うデータ
396+
@param num 配列処理の残り段数
397397
@return 処理された JSON ノードデータ.
398398
*/
399399
tJson* json_array_parse(tJson* json, char* pp, int num)
@@ -740,14 +740,19 @@ void _json_to_Buffer(tJson* pp, Buffer* buf, const char* crlf, const char* spac
740740
cat_s2Buffer(pp->ldat.key.buf, buf);
741741
cat_s2Buffer("\": ", buf);
742742
}
743-
cat_s2Buffer("[", buf);
744-
if (pp->next!=NULL) {
745-
if (crlf[0]!='\0') cat_s2Buffer(crlf, buf);
746-
_json_to_Buffer(pp->next, buf, crlf, space);
747-
if (space[0]!='\0') for(i=0; i<pp->depth; i++) cat_s2Buffer(space, buf);
743+
if (pp->ldat.val.buf!=NULL) {
744+
cat_s2Buffer(pp->ldat.val.buf, buf);
745+
}
746+
else {
747+
cat_s2Buffer("[", buf);
748+
if (pp->next!=NULL) {
749+
if (crlf[0]!='\0') cat_s2Buffer(crlf, buf);
750+
_json_to_Buffer(pp->next, buf, crlf, space);
751+
if (space[0]!='\0') for(i=0; i<pp->depth; i++) cat_s2Buffer(space, buf);
752+
}
753+
//if (space[0]!='\0') for(i=0; i<pp->depth; i++) cat_s2Buffer(space, buf);
754+
cat_s2Buffer("]", buf);
748755
}
749-
//if (space[0]!='\0') for(i=0; i<pp->depth; i++) cat_s2Buffer(space, buf);
750-
cat_s2Buffer("]", buf);
751756
}
752757

753758
else if (pp->ldat.id==JSON_ARRAY_VALUE_NODE) {

0 commit comments

Comments
 (0)