Skip to content

🐛 Bug Report: Python 3.9 function res.json() empty dict serialized as an array #6056

Description

@tripolskypetr

👟 Reproduction steps

The following python code

defmain(req, res):
returnres.json({
"rows": [],
"total": 0,
"filterData": {},
"pagination": {
"limit": 10,
"offset": 0,
},
"sortModel": [],
"chips": {},
"search": "",
"payload": {},
})

should return these JSON structure

{
"rows": [],
"total": 0,
"filterData": {},
"pagination": {
"limit": 10,
"offset": 0
},
"sortModel": [],
"chips": {},
"search": "",
"payload": {}
}

👍 Expected behavior

It returns

{
"rows": [],
"total": 0,
"filterData": {},
"pagination": {
"limit": 10,
"offset": 0
},
"sortModel": [],
"chips": {},
"search": "",
"payload": {}
}

👎 Actual Behavior

But every dict without any properties was serialized as a list

{
"chips": [],
"filterData": [],
"pagination": { "limit": 10, "offset": 0 },
"payload": [],
"rows": [],
"search": "",
"sortModel": [],
"total": 0
}

Proof

image

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Linux

🧱 Your Environment

Appwrite Cloud 1.1.2

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproduct / cloudIssues found only on Appwrite Cloudproduct / functionsFixes and upgrades for the Appwrite Functions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions