comparison src/goodjava/json/JsonToString.java @ 1477:509736ad42e6

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 21 Apr 2020 15:05:39 -0600
parents 59fd2e8b1b9d
children 6a24c8b33d6b
comparison
equal deleted inserted replaced
1476:7d145095cc0b 1477:509736ad42e6
148 } 148 }
149 149
150 private void toString(Map.Entry entry,StringBuilder sb,int indented) throws JsonException { 150 private void toString(Map.Entry entry,StringBuilder sb,int indented) throws JsonException {
151 Object key = entry.getKey(); 151 Object key = entry.getKey();
152 if( !(key instanceof String) ) 152 if( !(key instanceof String) )
153 throw new JsonException("table keys must be strings"); 153 throw new JsonException("table keys must be strings but got "+key.getClass().getSimpleName()+" ("+key+"="+entry.getValue()+")");
154 toString((String)key,sb); 154 toString((String)key,sb);
155 sb.append(colon); 155 sb.append(colon);
156 toString(entry.getValue(),sb,indented); 156 toString(entry.getValue(),sb,indented);
157 } 157 }
158 158