O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pretty view

To display JSON values in pretty format, use the JSON_PRETTY() function:

mysql> SELECT emp_no, JSON_PRETTY(details) FROM emp_details \G*************************** 1. row *************************** emp_no: 1JSON_PRETTY(details): { "email": "abc@example.com", "phone": "+11800000000", "address": { "pin": "560103", "city": "Bangalore", "line1": "abc", "line2": "xyz street" }, "location": "IN"}1 row in set (0.00 sec)

Without pretty:

mysql> SELECT emp_no, details FROM emp_details \G*************************** 1. row *************************** emp_no: 1details: {"email": "abc@example.com", "phone": "+11800000000", "address": {"pin": "560100", "city": "Bangalore", "line1": "abc", "line2": "xyz street"}, "location": "IN"}1 row in set ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required