ljharb/qs

qs.stringify(json) and qs.parse(json) Results are inconsistent with expectations

Open

#471 建立於 2023年5月5日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)JavaScript (8,015 star) (744 fork)batch import
bughelp wanted

描述

When my json is like this

[
    {
        "fansUid": "",
        "masterShopId": 0,
        "items": [
            {
                "itemId": "",
                "skus": [
                    {
                        "price": 0,
                        "skuId": 0,
                        "promotionToolCode": ""
                    }
                ]
            }
        ],
        "scene": ""
    }
]

i use qs.stringify(json) and qs.parse(json) . but result is

[
    {
        "fansUid": "",
        "masterShopId": "0",
        "items": [
            {
                "itemId": "",
                "skus": [
                    {
                        "[price]": "0",
                        "[skuId]": "0",
                        "[promotionToolCode]": ""
                    }
                ]
            }
        ],
        "scene": ""
    }
]

It was obvious that this was a mistake. How should I solve it

I tried to change multiple versions as well, but the latest version still did not fix the problem.

貢獻者指南