Sorting API output?

I’ve been trying to find a way to sort the output from an API query, say by hostname or by last state change etc. Am I missing something or is this missing from the API?

Hi,

you can use jq or python -m json.tool. Some small examples you’ll find here https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#responses
more about jq you’ll find here https://hyperpolyglot.org/json

1 Like

Just what @stevie-sy said. :slight_smile: The API was never made to be human readable. It should provide easy machine readable output which you can then process through other tools.

1 Like