+ 2

Json Object Library

I am developing a JSON object library in Java, which is nearly complete at around 250 lines of code. However, I'm facing a small issue that I haven't been able to resolve. If anyone is experienced with this and can offer assistance, please reach out https://sololearn.com/compiler-playground/ckFFEHUA6H6W/?ref=app The problem is the arrays cannot hold objects or keys

21st Oct 2024, 3:08 PM
LORD HOSSEIN
LORD HOSSEIN - avatar
2 Answers
+ 1
main(): jsonObject.set("array[4].subKey", "End value"); set(..): process keys[array, 4, subkey] : loop 0: search "array" item loop 1: add index "4" to "array" set "array[4]" to JSONNull current = JSONNull; (loop 3: end of loop) // handle "subKey": if (current is JSONObject) .. else if (current is JSONArray) .. } //end of method here is the problem, current is JSONNull and there is no case for handling such type. So jsonValue is not set in the "array[4]".
5th Nov 2024, 8:57 AM
zemiak
+ 1
zemiak Thanks But I'm change all the code two week ago because isn't fast and flexible
5th Nov 2024, 11:15 AM
LORD HOSSEIN
LORD HOSSEIN - avatar