+ 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
2 ответов
+ 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]".
     
+ 1
zemiak Thanks 
But I'm change all the code two week ago because isn't fast and flexible



