@@ -30,11 +30,12 @@ of this software and associated documentation files (the "Software"), to deal
3030import java .lang .reflect .Field ;
3131import java .lang .reflect .Method ;
3232import java .lang .reflect .Modifier ;
33- import java .math .*;
33+ import java .math .BigDecimal ;
34+ import java .math .BigInteger ;
3435import java .util .Collection ;
3536import java .util .Enumeration ;
36- import java .util .LinkedHashMap ;
3737import java .util .Iterator ;
38+ import java .util .LinkedHashMap ;
3839import java .util .Locale ;
3940import java .util .Map ;
4041import java .util .Map .Entry ;
@@ -131,7 +132,8 @@ public boolean equals(Object object) {
131132 *
132133 * @return The string "null".
133134 */
134- public String toString () {
135+ @ Override
136+ public String toString () {
135137 return "null" ;
136138 }
137139 }
@@ -717,6 +719,10 @@ public String getString(String key) throws JSONException {
717719 if (object instanceof String ) {
718720 return (String ) object ;
719721 }
722+ // András changed this
723+ if (object instanceof Number ) {
724+ return object .toString ();
725+ }
720726 throw new JSONException ("JSONObject[" + quote (key ) + "] not a string." );
721727 }
722728
@@ -1579,7 +1585,8 @@ public JSONArray toJSONArray(JSONArray names) throws JSONException {
15791585 * brace)</small> and ending with <code>}</code> <small>(right
15801586 * brace)</small>.
15811587 */
1582- public String toString () {
1588+ @ Override
1589+ public String toString () {
15831590 try {
15841591 return this .toString (0 );
15851592 } catch (Exception e ) {
0 commit comments