comparison src/goodjava/json/JsonToString.java @ 1620:99a8ac891914

JsonToString minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 25 Jul 2021 18:59:23 -0600
parents f989778ca9e1
children
comparison
equal deleted inserted replaced
1619:83caee2ed4ad 1620:99a8ac891914
15 } 15 }
16 16
17 public String toString(Object obj) throws JsonException { 17 public String toString(Object obj) throws JsonException {
18 StringBuilder sb = new StringBuilder(); 18 StringBuilder sb = new StringBuilder();
19 toString(obj,sb,0); 19 toString(obj,sb,0);
20 if( !compressed )
21 sb.append('\n');
22 return sb.toString(); 20 return sb.toString();
23 } 21 }
24 22
25 private void toString(Object obj,StringBuilder sb,int indented) throws JsonException { 23 private void toString(Object obj,StringBuilder sb,int indented) throws JsonException {
26 if( obj == null || obj instanceof Boolean || obj instanceof Number ) { 24 if( obj == null || obj instanceof Boolean || obj instanceof Number ) {