While it was always technically possible to store JSON in MySQL database columns, it was never a particularly attractive option. JSON data is just text, so any string type of sufficient length will take it quite happily. However, getting your JSON into the database using this method is one thing, but getting it back out again in any useful format had to be the responsibility of your application.
All that changed in MySQL 5.7.8 with the introduction of a native JSON data type and a range of useful built-in functions that made JSON a first-class citizen of MySQL.
In this post, we'll have a look at some of the functions you can use to store JSON data. Later posts will cover retrieving and otherwise manipulating that data.
Imagine that we are an online retailer, selling a range of electronics equipment. We sell anything from top of the range TVs to toasters. Clearly all these items will have things in common: they will be …
[Read more]