I'm trying to pass a json object from my python code with psycopg2 like this to a postgres stored procedure:
{
"experience": null,
"phoneNumber": [
"091184xxx"
],
"location": "tehran"
}
but this error occur:
ERROR: malformed array literal: "phoneNumbers" Detail: Array value must start with "{" or dimension information.
how can I fix this error?
UPDATE: here is my stored procedure:
CREATE OR REPLACE FUNCTION data(job_req JSONB)
RETURNS VOID
AS $$
DECLARE
INSERT INTO "JobRequirements" (expertise,"phoneNumbers", "location")
VALUES (
job_req ->> 'expertise',
job_req ->> 'phoneNumbers' :: VARCHAR [],
job_req ->> 'location'
);
END;
$$ LANGUAGE 'plpgsql';
and type of "phoneNumbers" column is varchar(255) []