I'm trying for the first time to enter some JsonValue in a JsonObject. The main focus is to create in an output file an array containing "x" number of json object. When I try to do this, I receive a NullPointerException. Someone could help me?
JsonObject jObj = new JsonObject();
JsonValue nome = "hey";
JsonValue cognome = "hoy";
jObj.put("nome", nome);
jObj.put("cognome", cognome);
FileOutputStream fileOutput = new FileOutputStream("C:\\Users\\francesco.campanile\\Desktop\\Eclipse workspace\\CreazionePropedeutiche\\src\\Prop1.json");
JsonWriter jWriter = Json.createWriter(fileOutput);
jWriter.writeObject(jObj);
jWriter.close();
Aucun commentaire:
Enregistrer un commentaire