You could try something like this: https://medium.com/@thakuramit3/laravel-provides-an-efficient-way-to-handle-json-column-in-the-table-with-its-magical-tool-a957c13004bf
But remember, this will save your JSON objects in an array format in DB
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using a json Field to store multiple values of a dropdown. The array is like
["Male"=>"Male","Female"=>"Female","Test"=>"Test"]
but when I check the values in database after saving in JSON field it is of below format.
{"Male": "Male", "Test": "Test", "Female": "Female"}
Upon searching a bit it seems that MySql sorts them. What could be a possible solution to overcome these?
Please or to participate in this conversation.