'Saving object as Text
I am trying to send a request which updates a field in database[pg]. I have a freelancer entity with a field that needs to be updated.
@Column('varchar', {
array: true
})
work_days: string;
This is my postman request :
{
"days": [1, 2] ,
"time": {
"to":8,
"from": 9
}
}
Also i have my DTO like:
@IsNotEmpty()
days: number[];
@IsNotEmpty()
time: string;
What i want is to save this request body as text in my db.
But i get this error
malformed array literal: "{"days":[1,2],"time":{"to":8,"from":9}}"
I have tried using it as raw sql still having the same error. So i am sure there's something wrong with the syntax.
Solution 1:[1]
Maybe this helps you out: U114: Malformed array literal As well as this: PostGres Docs Arrays
The string you want to pass needs to be passed in the right PostGres array syntax.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | db3000 |
