#C4700. Filter and Sort Active Employees

    ID: 48268 Type: Default 1000ms 256MiB

Filter and Sort Active Employees

Filter and Sort Active Employees

You are given a JSON array of employees. Each employee is represented as an object with the following attributes: name (a string), employee_id (an integer), and is_active (a boolean). Your task is to filter out the inactive employees (i.e. those with is_active equal to false) and then sort the remaining active employees in ascending order by their employee_id. The final list should be output as a JSON array.

The sorting criteria can be represented as follows: $$\text{Sort by } employee\_id \text{ in ascending order.}$$

inputFormat

The input is provided through standard input (stdin) as a single line containing a JSON array. Each element in the array is an object representing an employee with the properties:

  • name: string
  • employee_id: integer
  • is_active: boolean

outputFormat

Output a JSON array (on stdout) of the active employees sorted by their employee_id in ascending order. The result should be printed in one line.

## sample
[{"name": "John Doe", "employee_id": 3, "is_active": false}, {"name": "Jane Smith", "employee_id": 1, "is_active": true}, {"name": "Alice Brown", "employee_id": 2, "is_active": true}]
[{"name":"Jane Smith","employee_id":1,"is_active":true},{"name":"Alice Brown","employee_id":2,"is_active":true}]