postgres において検索結果を json形式で取得しつつ 指定列のみ取得し指定キーでソートする sqlの書き方(json_build_objectを使う) json_build_object postgres

postgres において、検索結果を
・json形式で取得しつつ
・指定列のみ取得し(link_idとwidthとdisplay_order列だけ取得)
・指定キーでソート(display_order)
する sqlの書き方

a_db=# SELECT json_build_object('link_id',link_id,'width',width,'display_order',display_order) from m_uq_dashboard ORDER BY display_order ;
json_build_object
----------------------------------------------------------------------------------------------
{"link_id" : "", "width" : 4, "display_order" : 1}
{"link_id" : "", "width" : 4, "display_order" : 1}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 4}
(7 行)

a_db=#
a_db=# SELECT json_build_object('link_id',link_id,'width',width,'display_order',display_order) from m_uq_dashboard
a_db-# ;
json_build_object
----------------------------------------------------------------------------------------------
{"link_id" : "", "width" : 4, "display_order" : 1}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 1}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 4}
(7 行)

a_db=#
a_db=# SELECT json_build_object('link_id',link_id,'width',width,'display_order',display_order) from m_uq_dashboard ORDER BY display_order desc ;
;
json_build_object
----------------------------------------------------------------------------------------------
{"link_id" : "", "width" : 4, "display_order" : 4}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 3}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 2}
{"link_id" : "", "width" : 4, "display_order" : 1}
{"link_id" : "", "width" : 4, "display_order" : 1}
(7 行)

a_db=#

----------------------------------------------------------------------------------------------