Use Object.keys to iterate over the keys of an object.
Example:
const input = {
"insects":
[
{"name":"wasp"}
,{"name":"spider"}
],
"birds":
[
{"name":"eagle"}
,{"name":"pigeon"}
]
};
const categories = Object.keys(input); // categories now contains ["insect", "birds"]
Now you can iterate over the categories to do whatever you want to do with them.