I have this JSON for example:
{
"mesaje": [{
"cif": "111",
"data_creare": "29.11.2019 07:52:24",
"id_solicitare": "222",
"tip": "SOLICITARE",
"id": "333",
"detalii": "duplicat pentru CUI 111"
}, {
"cif": "444",
"data_creare": "29.11.2019 07:59:37",
"id_solicitare": "555",
"tip": "SOLICITARE",
"id": "666",
"detalii": "duplicat pentru CUI 888"
}],
"serial": "aaaaaaaaaaaaaaaaa",
"cnp": "1888888888888888"
This is the code that I have written in Java:
public static void main(String[] args) throws FileNotFoundException, IOException, ParseException {
JSONParser parser = new JSONParser();
try (Reader reader = new FileReader("D:\\test.json")) {
JSONObject jsonObject = (JSONObject) parser.parse(reader);
System.out.println(jsonObject);
String cif = (String) jsonObject.get("serial");
System.out.println(cif);
}
}
This prints out the serial number…but what I would like to do is to acces for example in mesaje → cif , or. mesaje → data_creare…the library used is json-simple…can you please help me with how I could do that ? Thanks in advance