PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → JSON array not allowed in HTTP post content
JSON array not allowed in HTTP post content
Started by Jim, Apr., 11 2025 7:25 PM - 1 reply
Posted on April, 11 2025 - 7:25 PM
We keep getting this syntax error although it is valid.
We are wondering if it is a WINDEV bug. WINDEV won't allow an array here.
We want to use this in a website that requires an array. beebotte.com

MyRequest..ContentType = "application/json"
MyRequest..Content = [
{
"library": {
"name": "City Central Library",
"books": [
{
"id": "book1",
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"year": 1960
},
{
"id": "book2",
"title": "1984",
"author": "George Orwell",
"year": 1949
}
]
}
}
]

Thanks
Jim
Posted on April, 21 2025 - 1:29 PM
Jim a écrit :
We keep getting this syntax error although it is valid.
We are wondering if it is a WINDEV bug. WINDEV won't allow an array here.
We want to use this in a website that requires an array. beebotte.com

MyRequest..ContentType = "application/json"
MyRequest..Content = [
{
"library": {
"name": "City Central Library",
"books": [
{
"id": "book1",
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"year": 1960
},
{
"id": "book2",
"title": "1984",
"author": "George Orwell",
"year": 1949
}
]
}
}
]

Thanks
Jim


Make use of backticks to declare the variable see (https://doc.windev.com/en-US/…)

Multiline string literal with backticks ( ` )

MyRequest.Content = `
{
"library": {
"name": "City Central Library",
"books": [
{
"id": "book1",
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"year": 1960
},
{
"id": "book2",
"title": "1984",
"author": "George Orwell",
"year": 1949
}
]
}
}
`