I hope someone can help me out as I am really struggling for this.
Basically what I am looking for is to be able to extract data properly from a json file. the contents of my file is:
{ "fonction": [
{
"nom":"f1 task3",
"period":"150",
"execution_time":"3",
"weight":"4",
"nb_inst":"22",
"proba":"0.2",
"cout_comm":"8",
"destination":"f2",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f1 task3",
"period":"150",
"execution_time":"3",
"weight":"4",
"nb_inst":"22",
"proba":"0.2",
"cout_comm":"4",
"destination":"f3",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f1 task3",
"period":"150",
"execution_time":"3",
"weight":"4",
"nb_inst":"22",
"proba":"0.5",
"cout_comm":"12",
"destination":"f4",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f2 task3",
"period":"200",
"execution_time":"3",
"weight":"2",
"nb_inst":"21",
"proba":"0.1",
"cout_comm":"10",
"destination":"f5",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f2 task3",
"period":"200",
"execution_time":"3",
"weight":"2",
"nb_inst":"21",
"proba":"0.9",
"cout_comm":"2",
"destination":"f6",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f3 task3",
"period":"210",
"execution_time":"5",
"weight":"5",
"nb_inst":"16",
"proba":"0.3",
"cout_comm":"7",
"destination":"f6",
"nom_cond":"inclusion",
"nom_fct":"f1"
},
{
"nom":"f3 task3",
"period":"210",
"execution_time":"5",
"weight":"5",
"nb_inst":"16",
"proba":"0.7",
"cout_comm":"9",
"destination":"f7",
"nom_cond":"inclusion",
"nom_fct":"f1"
},
{
"nom":"f4 task3",
"period":"180",
"execution_time":"5",
"weight":"6",
"nb_inst":"25",
"proba":"0.6",
"cout_comm":"6",
"destination":"f7",
"nom_cond":"inclusion",
"nom_fct":"f1"
},
{
"nom":"f4 task3",
"period":"180",
"execution_time":"5",
"weight":"6",
"nb_inst":"25",
"proba":"0.4",
"cout_comm":"6",
"destination":"f8",
"nom_cond":"inclusion",
"nom_fct":"f1"
},
{
"nom":"f5 task3 ",
"period":"190",
"execution_time":"5",
"weight":"3",
"nb_inst":"12",
"proba":"0",
"cout_comm":"0",
"destination":"",
"nom_cond":"",
"nom_fct":""
},
{
"nom":"f6 task3",
"period":"210",
"execution_time":"4",
"weight":"1",
"nb_inst":"23",
"proba":"0.9",
"cout_comm":"7",
"destination":"f5",
"nom_cond":"exclusion",
"nom_fct":"f3"
},
{
"nom":"f6 task3",
"period":"210",
"execution_time":"4",
"weight":"1",
"nb_inst":"23",
"proba":"0.1",
"cout_comm":"4",
"destination":"f7",
"nom_cond":"exclusion",
"nom_fct":"f3"
},
{
"nom":"f7 task3",
"period":"220",
"execution_time":"1",
"weight":"5",
"nb_inst":"16",
"proba":"0",
"cout_comm":"0",
"destination":"",
"nom_cond":"exclusion",
"nom_fct":"f3"
},
{
"nom":"f8 task3",
"period":"260",
"execution_time":"4",
"weight":"4",
"nb_inst":"19",
"proba":"0",
"cout_comm":"0",
"destination":"",
"nom_cond":"",
"nom_fct":""
} ], "proc": [
{
"id":"1",
"wight_max":"40",
"frequency":"250",
"voltage":"1.2",
"nb_inst_cycle":"3",
"energy_cycle":"6",
"energy":"214"
},
{
"id":"2",
"wight_max":"40",
"frequency":"300",
"voltage":"1.32",
"nb_inst_cycle":"3",
"energy_cycle":"6",
"energy":"214"
},
{
"id":"3",
"wight_max":"40",
"frequency":"400",
"voltage":"1.7",
"nb_inst_cycle":"3",
"energy_cycle":"7",
"energy":"214"
}]}
I found many tutorials/guide but nothing that could help me really.
How do I do this in java? and what is the best parser to do this?
Thank you