change JSONObject to extends LinkedHashMap<String, Object> this will prevent non string keys. I Would also suggest overriding all put methods to check for null keys as JSON Specification according to https://jsoneditoronline.org/ JSON null keys are not allowed.
I believe this is the easiest way to fix the string keys for the current library. I can't do it that way for evilnotchlib as everything is compiled with JSONObject being <Object, Object>