I have the following JSON structure and I want to grab n random elements of each category (area_description) instead of displaying everything in a d3 visualization. What is the most clean way I can achieve that? My idea was to sort the JSON by area description and get the start and end of each category and then grab elements.
[
{
"id": 1,
"number": "2-1",
"type": "GENERAL",
"location": "US2",
"floor": 2,
"area_description": "High Perfomance Computing",
"status": "ASSIGNED"
},
{
"id": 2,
"number": "2-2",
"type": "GENERAL",
"location": "US2",
"floor": 2,
"area_description": "High Perfomance Computing",
"status": "AVAILABLE"
},
{
"id": 3,
"number": "2-3",
"type": "GENERAL",
"location": "US2",
"floor": 2,
"area_description": "Cloud",
"status": "AVAILABLE"
},
{
"id": 4,
"number": "2-4",
"type": "GENERAL",
"location": "US2",
"floor": 2,
"area_description": "Cloud",
"status": "AVAILABLE"
},
{
"id": 5,
"number": "2-5",
"type": "GENERAL",
"location": "US2",
"floor": 2,
"area_description": "Static",
"status": "ASSIGNED"
}]