How to format JSON via PHP

I have a PHP that writes JSON Code to a JSON file, looks like this:

`

if ($_GET["aktion"] == "erstellen") {
  $date = new DateTime('now', new DateTimeZone('Europe/Berlin'));

  $text_in = $_POST["inhalt"];
  $text_in = htmlentities($text_in);
  $text_in = str_replace("n", "<br>", $text_in);

  $newTicket = [
    'ticket_art' => $_POST["art"],
    'von_name' => $_POST["name"],
    'ticket_titel' => $_POST["titel"],
    'ticket' => $text_in,
    'datum' => date("d.m.Y"),
    'uhrzeit' => $date->format('H:i:s'),
    'status' => "Ausstehend",
    'zustand' => "open"
  ];

  array_push($items, $newTicket);
  file_put_contents('DB/open/tickets.json', json_encode($items, JSON_PRETTY_PRINT));

  echo "<meta http-equiv="refresh" content="0;URL=?aktion=0&iid=">";
}

// Löschen von Ticket
if ($_GET["aktion"] == 11) {

  $iindex = $_GET['iid'];
  $index = count($items) - 1 - $iindex;

  unset($items[$index]);
  file_put_contents('DB/open/tickets.json', json_encode($items, JSON_PRETTY_PRINT));  

  echo "<meta http-equiv="refresh" content="0;URL=?aktion=0&iid=">";
}

if ($aktion == 12) {
  $id_index = count($items) - 1 - $_GET["iid"];

  foreach ($items as $index => $row) {
    if ($index == $id_index) {
      $xxa = $row['ticket_art'];
      $xxb = $row['von_name'];
      $xxc = $row['ticket_titel'];
      $xxd = $row['ticket'];
      $xxe = $row['datum'];
      $xxf = $row['uhrzeit'];
      $xxg = $row['status'];
      $xxh = $row['zustand'];
    }
  }

  $repTicket = [
    'ticket_art' => $xxa,
    'von_name' => $xxb,
    'ticket_titel' => $xxc,
    'ticket' => $xxd,
    'datum' => $xxe,
    'uhrzeit' => $xxf,
    'status' => $xxg,
    'zustand' => "wait"
  ];

  $items[$id_index] = $repTicket;
  file_put_contents('DB/open/tickets.json', json_encode($items, JSON_PRETTY_PRINT));

  $handler = fopen('DB/abzihen.txt', 'a+');
  fwrite($handler, ".n");
  fclose($handler);

  echo "<meta http-equiv="refresh" content="0;URL=?aktion=0&iid=">";
}

`

Okay and if I push a SEND Button, the JSON File looks normal like:

[ { "someting": "something", "something": "something" } ]

And if I push a delete Button, my Json looks like this:

{ "0": { "something": "something", "something": "something" } }

So here is my question: How do I get the JSON into the old format back, where it is a Array?
Is there any PHP method to format it back or something like that?

Thank you!

I would be verry Happy if you can help me please