Hi all - looking for some assistance extracting some data from JSON. I’m okay pulling basic info from JSON, but in this case I have a list I need to match against, that is extract appropriate “ZONE #” for a given date (start of week for rubbish collection) from the data down the bottom here.
I have a template sensor that sets to the appropriate date (i.e. date of the first day of the current week), so figured some kind of way “find this string, then give me the next bit” approach (regex?? never used this?)
{
"help":"https://www.data.brisbane.qld.gov.au/data/api/3/action/help_show?name=datastore_search",
"success":true,
"result":{
"include_total":true,
"limit":53,
"records_format":"objects",
"resource_id":"c6dbb0b3-1e00-4bb8-8776-aa1b8f1ecfaa",
"total_estimation_threshold":null,
"records":[
{
"_id":1,
"WEEK_STARTING":"29/11/2021",
"ZONE":"ZONE 2"
},
{
"_id":2,
"WEEK_STARTING":"6/12/2021",
"ZONE":"ZONE 1"
},
{
"_id":3,
"WEEK_STARTING":"13/12/2021",
"ZONE":"ZONE 2"
},
{
"_id":4,
"WEEK_STARTING":"20/12/2021",
"ZONE":"ZONE 1"
},
{
"_id":5,
"WEEK_STARTING":"27/12/2021",
"ZONE":"ZONE 2"
},
{
"_id":6,
"WEEK_STARTING":"3/01/2022",
"ZONE":"ZONE 1"
},
{
"_id":7,
"WEEK_STARTING":"10/01/2022",
"ZONE":"ZONE 2"
},
{
"_id":8,
"WEEK_STARTING":"17/01/2022",
"ZONE":"ZONE 1"
},
{
"_id":9,
"WEEK_STARTING":"24/01/2022",
"ZONE":"ZONE 2"
},
{
"_id":10,
"WEEK_STARTING":"31/01/2022",
"ZONE":"ZONE 1"
},
{
"_id":11,
"WEEK_STARTING":"7/02/2022",
"ZONE":"ZONE 2"
},
{
"_id":12,
"WEEK_STARTING":"14/02/2022",
"ZONE":"ZONE 1"
},
{
"_id":13,
"WEEK_STARTING":"21/02/2022",
"ZONE":"ZONE 2"
},
{
"_id":14,
"WEEK_STARTING":"28/02/2022",
"ZONE":"ZONE 1"
},
{
"_id":15,
"WEEK_STARTING":"7/03/2022",
"ZONE":"ZONE 2"
},
{
"_id":16,
"WEEK_STARTING":"14/03/2022",
"ZONE":"ZONE 1"
},
{
"_id":17,
"WEEK_STARTING":"21/03/2022",
"ZONE":"ZONE 2"
},
{
"_id":18,
"WEEK_STARTING":"28/03/2022",
"ZONE":"ZONE 1"
},
{
"_id":19,
"WEEK_STARTING":"4/04/2022",
"ZONE":"ZONE 2"
},
{
"_id":20,
"WEEK_STARTING":"11/04/2022",
"ZONE":"ZONE 1"
},
{
"_id":21,
"WEEK_STARTING":"18/04/2022",
"ZONE":"ZONE 2"
},
{
"_id":22,
"WEEK_STARTING":"25/04/2022",
"ZONE":"ZONE 1"
},
{
"_id":23,
"WEEK_STARTING":"2/05/2022",
"ZONE":"ZONE 2"
},
{
"_id":24,
"WEEK_STARTING":"9/05/2022",
"ZONE":"ZONE 1"
},
{
"_id":25,
"WEEK_STARTING":"16/05/2022",
"ZONE":"ZONE 2"
},
{
"_id":26,
"WEEK_STARTING":"23/05/2022",
"ZONE":"ZONE 1"
},
{
"_id":27,
"WEEK_STARTING":"30/05/2022",
"ZONE":"ZONE 2"
},
{
"_id":28,
"WEEK_STARTING":"6/06/2022",
"ZONE":"ZONE 1"
},
{
"_id":29,
"WEEK_STARTING":"13/06/2022",
"ZONE":"ZONE 2"
},
{
"_id":30,
"WEEK_STARTING":"20/06/2022",
"ZONE":"ZONE 1"
},
{
"_id":31,
"WEEK_STARTING":"27/06/2022",
"ZONE":"ZONE 2"
},
{
"_id":32,
"WEEK_STARTING":"4/07/2022",
"ZONE":"ZONE 1"
},
{
"_id":33,
"WEEK_STARTING":"11/07/2022",
"ZONE":"ZONE 2"
},
{
"_id":34,
"WEEK_STARTING":"18/07/2022",
"ZONE":"ZONE 1"
},
{
"_id":35,
"WEEK_STARTING":"25/07/2022",
"ZONE":"ZONE 2"
},
{
"_id":36,
"WEEK_STARTING":"1/08/2022",
"ZONE":"ZONE 1"
},
{
"_id":37,
"WEEK_STARTING":"8/08/2022",
"ZONE":"ZONE 2"
},
{
"_id":38,
"WEEK_STARTING":"15/08/2022",
"ZONE":"ZONE 1"
},
{
"_id":39,
"WEEK_STARTING":"22/08/2022",
"ZONE":"ZONE 2"
},
{
"_id":40,
"WEEK_STARTING":"29/08/2022",
"ZONE":"ZONE 1"
},
{
"_id":41,
"WEEK_STARTING":"5/09/2022",
"ZONE":"ZONE 2"
},
{
"_id":42,
"WEEK_STARTING":"12/09/2022",
"ZONE":"ZONE 1"
},
{
"_id":43,
"WEEK_STARTING":"19/09/2022",
"ZONE":"ZONE 2"
},
{
"_id":44,
"WEEK_STARTING":"26/09/2022",
"ZONE":"ZONE 1"
},
{
"_id":45,
"WEEK_STARTING":"3/10/2022",
"ZONE":"ZONE 2"
},
{
"_id":46,
"WEEK_STARTING":"10/10/2022",
"ZONE":"ZONE 1"
},
{
"_id":47,
"WEEK_STARTING":"17/10/2022",
"ZONE":"ZONE 2"
},
{
"_id":48,
"WEEK_STARTING":"24/10/2022",
"ZONE":"ZONE 1"
},
{
"_id":49,
"WEEK_STARTING":"31/10/2022",
"ZONE":"ZONE 2"
},
{
"_id":50,
"WEEK_STARTING":"7/11/2022",
"ZONE":"ZONE 1"
},
{
"_id":51,
"WEEK_STARTING":"14/11/2022",
"ZONE":"ZONE 2"
},
{
"_id":52,
"WEEK_STARTING":"21/11/2022",
"ZONE":"ZONE 1"
},
{
"_id":53,
"WEEK_STARTING":"28/11/2022",
"ZONE":"ZONE 2"
}
],
"fields":[
{
"id":"_id",
"type":"int"
},
{
"id":"WEEK_STARTING",
"type":"text"
},
{
"id":"ZONE",
"type":"text"
}
],
"_links":{
"start":"/api/3/action/datastore_search?resource_id=c6dbb0b3-1e00-4bb8-8776-aa1b8f1ecfaa&limit=53",
"next":"/api/3/action/datastore_search?resource_id=c6dbb0b3-1e00-4bb8-8776-aa1b8f1ecfaa&limit=53&offset=53"
},
"total":162,
"total_was_estimated":false
}
}