Postgres JSON output using specific column as JSON key
You can use json_build_object function which allows you to calculate keys or values. 

WITH l AS (SELECT id, my_json as data FROM table)
SELECT json_build_object(id, data) FROM l;


The result will be like; 

|                        json_build_object |
|------------------------------------------|
| {"1" : {"a": 1, "b": 2, "c": [1, 2, 3]}} |
| {"2" : {"a": 1, "b": 2, "c": [1, 2, 3]}} |


Here is sample fiddle