This commit is contained in:
Looly
2024-09-30 00:02:11 +08:00
parent 5f45b2275e
commit 867e1ce55e
5 changed files with 27 additions and 21 deletions

View File

@@ -225,7 +225,9 @@ public interface JSON extends Serializable {
* @throws JSONException 包含非法数抛出此异常
*/
default String toJSONString(final int indentFactor) throws JSONException {
return toJSONString(indentFactor, null);
final JSONWriter jsonWriter = getFactory().ofWriter(new StringBuilder(), indentFactor);
this.write(jsonWriter);
return jsonWriter.toString();
}
/**