fix indents for child elements when using -1 (#2119)

This commit is contained in:
Ben Fry
2013-10-11 19:27:10 -04:00
parent 316a600a9d
commit c1b076ba07
3 changed files with 15 additions and 13 deletions

View File

@@ -1790,9 +1790,10 @@ public class JSONObject {
if (actualFactor > 0) {
writer.write(' ');
}
writeValue(writer, this.map.get(key), actualFactor, indent);
//writeValue(writer, this.map.get(key), actualFactor, indent);
writeValue(writer, this.map.get(key), indentFactor, indent);
} else if (length != 0) {
final int newindent = indent + actualFactor;
final int newIndent = indent + actualFactor;
while (keys.hasNext()) {
Object key = keys.next();
if (commanate) {
@@ -1801,14 +1802,14 @@ public class JSONObject {
if (indentFactor != -1) {
writer.write('\n');
}
indent(writer, newindent);
indent(writer, newIndent);
writer.write(quote(key.toString()));
writer.write(':');
if (actualFactor > 0) {
writer.write(' ');
}
writeValue(writer, this.map.get(key), actualFactor,
newindent);
//writeValue(writer, this.map.get(key), actualFactor, newIndent);
writeValue(writer, this.map.get(key), indentFactor, newIndent);
commanate = true;
}
if (indentFactor != -1) {