mirror of
https://github.com/json-c/json-c.git
synced 2026-03-25 07:59:07 +08:00
Merge pull request #453 from darjankrijan/master
Fixed misalignment in JSON string due to space after \n being printed...
This commit is contained in:
@@ -395,7 +395,7 @@ static int json_object_object_to_json_string(struct json_object* jso,
|
||||
printbuf_strappend(pb, "\n");
|
||||
}
|
||||
had_children = 1;
|
||||
if (flags & JSON_C_TO_STRING_SPACED)
|
||||
if (flags & JSON_C_TO_STRING_SPACED && !(flags & JSON_C_TO_STRING_PRETTY))
|
||||
printbuf_strappend(pb, " ");
|
||||
indent(pb, level+1, flags);
|
||||
printbuf_strappend(pb, "\"");
|
||||
@@ -416,7 +416,7 @@ static int json_object_object_to_json_string(struct json_object* jso,
|
||||
printbuf_strappend(pb, "\n");
|
||||
indent(pb,level,flags);
|
||||
}
|
||||
if (flags & JSON_C_TO_STRING_SPACED)
|
||||
if (flags & JSON_C_TO_STRING_SPACED && !(flags & JSON_C_TO_STRING_PRETTY))
|
||||
return printbuf_strappend(pb, /*{*/ " }");
|
||||
else
|
||||
return printbuf_strappend(pb, /*{*/ "}");
|
||||
@@ -1134,7 +1134,7 @@ static int json_object_array_to_json_string(struct json_object* jso,
|
||||
printbuf_strappend(pb, "\n");
|
||||
}
|
||||
had_children = 1;
|
||||
if (flags & JSON_C_TO_STRING_SPACED)
|
||||
if (flags & JSON_C_TO_STRING_SPACED && !(flags&JSON_C_TO_STRING_PRETTY))
|
||||
printbuf_strappend(pb, " ");
|
||||
indent(pb, level + 1, flags);
|
||||
val = json_object_array_get_idx(jso, ii);
|
||||
@@ -1151,7 +1151,7 @@ static int json_object_array_to_json_string(struct json_object* jso,
|
||||
indent(pb,level,flags);
|
||||
}
|
||||
|
||||
if (flags & JSON_C_TO_STRING_SPACED)
|
||||
if (flags & JSON_C_TO_STRING_SPACED && !(flags&JSON_C_TO_STRING_PRETTY))
|
||||
return printbuf_strappend(pb, " ]");
|
||||
return printbuf_strappend(pb, "]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user