My JSON-File is:
[
{
"date":"2022-W04",
"moods":[
{"mood":4,"name":"Dennis"},
{"mood":3,"name":"Kevin"},
{"mood":3,"name":"Alexandros"},
{"mood":2,"name":"Tobias"},
{"mood":0,"name":"Andreas"}
]
},
{
"date":"2022-W05",
"moods":[
{"mood":0,"name":"Dennis"},
{"mood":0,"name":"Kevin"},
{"mood":3,"name":"Alexandros"},
{"mood":2,"name":"Tobias"},
{"mood":0,"name":"Andreas"}
]
}
]
I now want to have the index for example for date 2022-W05 to access its data(mood and name). Of course I could just loop through the entire array and check for the correct date but is there a better way to get the right index?