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 ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.