SELECT'json'AS component,JSON_OBJECT('messages',(SELECT JSON_GROUP_ARRAY(JSON_OBJECT('author',author,'message',message))FROM messages))AS contents;