skip to Main Content

Traverse a JsonNode

This is how much JsonNode response has different key value pairs, similar to the example below. How can I traverse it to get the response in both key and value pair. Thank you. { "message": "Results field contain api response",…

VIEW QUESTION

How could I read from an empty json File,at the start of the program is it empty but later can be written

The read file is that: public ArrayList<Aventura> readFile(){ ArrayList<Aventura> aventures = new ArrayList<>(); try{ AventuraDAO aventuraDAO=new AventuraDAO(); AventuraManage aventuraManage=new AventuraManage(aventuraDAO); Gson g=new Gson(); JsonReader reader=new JsonReader(new FileReader("Files/adventures.json")); Aventura[] ave=g.fromJson(reader, Aventura[].class ); if (ave.length==0){ System.out.println("The file should be empty"); ArrayList<Aventura> aventures2…

VIEW QUESTION
Back To Top
Search