Borvik / vscode-postgres

PostgreSQL extension for vscode providing explorer, highlighting, diagnostics, and intellisense
MIT License
226 stars 48 forks source link

JSON export has markup formatting in it #220

Closed ghost closed 1 year ago

ghost commented 1 year ago

I think this happened on the most recent release. When exporting results to JSON, they have markup and escaping in them.

Example script:

create temp table foo (
    id uuid,
    name varchar,
    data jsonb
);

insert into foo(id, name, data)
select gen_random_uuid(), case when s % 3 = 0 then null else s end, jsonb_build_object('prop', 'val' || s::varchar)
from generate_series(0, 10) s;

select * from foo;

Results in:

[
  {
    "id": "af893a22-a94f-4a34-afa6-aaafcd6f3113",
    "name": "<i>null</i>",
    "data": "{&#34;prop&#34;:&#34;val0&#34;}"
  },
  {
    "id": "fb066f58-5639-49e8-b0f5-a3e3f1dd762b",
    "name": "1",
    "data": "{&#34;prop&#34;:&#34;val1&#34;}"
  },
  {
    "id": "cbd62d6d-60ed-4457-8544-5caef6f332ab",
    "name": "2",
    "data": "{&#34;prop&#34;:&#34;val2&#34;}"
  },
  {
    "id": "4a5b19bd-7b43-489b-93a2-29917ab1102e",
    "name": "<i>null</i>",
    "data": "{&#34;prop&#34;:&#34;val3&#34;}"
  },
  {
    "id": "20edb7f1-c208-438b-b841-3b9528f2c54f",
    "name": "4",
    "data": "{&#34;prop&#34;:&#34;val4&#34;}"
  },
  {
    "id": "83b1e2bd-c433-47e4-ac85-36010eefab1f",
    "name": "5",
    "data": "{&#34;prop&#34;:&#34;val5&#34;}"
  },
  {
    "id": "d47651a6-d398-4e79-9d94-366745373b10",
    "name": "<i>null</i>",
    "data": "{&#34;prop&#34;:&#34;val6&#34;}"
  },
  {
    "id": "8a695829-f8ba-46e6-a7ed-117e2c9c475d",
    "name": "7",
    "data": "{&#34;prop&#34;:&#34;val7&#34;}"
  },
  {
    "id": "22399a2b-b1a3-4c73-974d-e44b3123ebb5",
    "name": "8",
    "data": "{&#34;prop&#34;:&#34;val8&#34;}"
  },
  {
    "id": "c218d564-b5f0-48f5-8f4b-8d1968695c94",
    "name": "<i>null</i>",
    "data": "{&#34;prop&#34;:&#34;val9&#34;}"
  },
  {
    "id": "dfd91260-e341-4f86-994f-328a3b9a3263",
    "name": "10",
    "data": "{&#34;prop&#34;:&#34;val10&#34;}"
  }
]
Borvik commented 1 year ago

this should be fixed in 1.4.2