logo

Don't rely on key ordering with MySQL JSON values

This behavior caught me by surprise

Joel Clermont
Joel Clermont
2025-10-24

You've likely heard that it's dangerous to rely on array keys maintaining a specific order. The JSON spec even defines these key/value pairs as "unordered".

But maybe in practice, you've never bumped into a situation where the order changed from what you expected.

In today's video, I show a real-world example where I bumped into this key-ordering issue when using MySQL JSON columns.

I take a peek under the hood to see why it's happening, and give some advice on how to avoid the issue in your application.

Watch Now (5 min)

And after watching, don't forget to subscribe to our YouTube channel, so you don't miss future videos.

Here to help,

Joel

P.S. If you're ever stuck on a weird Laravel issue like this, don't suffer alone! Let's pair and get you unstuck.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.