I want to load a formatted JSON file, in the form of
{
"EId":"104111",
"Category":"(0)",
"Mac":"ABV",
"Path":"chemin2",
"ID":"System.Byte"
}
by creating first a temporary table with a json column,
create temporary table temp_json (values json);
copy temp_json from '/path_to_the_file/test.json';
select values->>'EId' as EId,
values->>'Category' as Category,
values->>'Mac' as Mac,
values->>'Path' as Path,
values->>'ID' as ID
from(
select json_array_elements(values) as values
from temp_json
) a;
but it shows the following message:
ERROR: invalid input syntax for type JSON
DETAIL: The input string ended unexpectedly.
CONTEXT: JSON data, line 1: {
COPY temp_json, line 1, column values: "{"
once I erase all the whitespace, the instruction pass with no error.