Hello,
I know there is some history about JSONObject.put and the corresponding Exception (#402, #405, #385, and probably more).
What I want to suggest is to remove the JSONException from the put(..) methods and use the default IllegalArgumentException.
This would reduce some boilerplate code to write.
Currently I need to write
JSONObject json = new JSONObject();
try {
json.put("some-key", "some-value");
} catch (JSONException e) {
// Not happening
}
or with java8 Stream, I need some wrapper to handle the checked exception.
x.stream()
.filter(Objects::nonNull)
.map(value -> new JSONObject().put("some-key", value)) // doesn't work without wrapper
....
I know it is a breaking change. So maybe this is something to consider for a major update.
Sincerely
Christian
Hello,
I know there is some history about JSONObject.put and the corresponding Exception (#402, #405, #385, and probably more).
What I want to suggest is to remove the JSONException from the put(..) methods and use the default
IllegalArgumentException.This would reduce some boilerplate code to write.
Currently I need to write
or with java8 Stream, I need some wrapper to handle the checked exception.
I know it is a breaking change. So maybe this is something to consider for a major update.
Sincerely
Christian