1

Why does the order of keys change, when saved to the Mysql, in the JSON column? This is the order of the keys when creating the user:

$user->emailNotifications()->create([
            'settings' =>
                [
                    "orders"        => [
                        "paid"    => false,
                        "snipped" => false,
                    ],
                    "store_actions" => [
                        "added"               => false,
                        "deleted"             => false,
                        "transferred_license" => false,
                    ],
                    "billing"       => [
                        "changed_cycle"  => false,
                        "failed_payment" => false,
                    ],
                    "products"      => [
                        "deactivated" => false,
                    ],
                ],
        ]);

but stored in the database in a different order:

"orders": {
  "paid": true,
  "snipped": true
},
"billing": {
  "changed_cycle": false,
  "failed_payment": false
},
"products": {
  "deactivated": false
},
"store_actions": {
  "added": false,
  "deleted": false,
  "transferred_license": false
}

what could be the problem?

Katanji
  • 68
  • 8

0 Answers0