Skip to content

JSON

SELECT CAST('{"user":"John", "age":30, "city":"New York"}' AS JSON);
{
"user": "John",
"age": 30,
"city": "New York"
}

In the aforementioned example, a raw JSON string is selected and cast as JSON data type in MySQL. The JSON object holds a user named John, who is 30 years old, and lives in New York.