Cannot hanlde spaces at start of a string
Brought to you by:
aalmiray
json-lib cannot handle spaces at the start of a string:
String str = " {\"a\":123,\"b\":\"bla\"}";
JSONObject json = (JSONObject) JSONSerializer.toJSON(str);
will crash. I guess it has to do with the method JSONSerializer.toJSON(String string, JsonConfig jsonConfig):
...
if( string.startsWith( "[" ) ){
json = JSONArray.fromObject( string, jsonConfig );
}else if( string.startsWith( "{" ) ){
json = JSONObject.fromObject( string, jsonConfig );
...