Querystring在nodejs中没有正确地进行字符串化

时间:2012-06-21 11:18:35

标签: javascript node.js

这是我的问题,

这是我的字符串:

    var body = {
        message: "Hello",
        properties: [
            { text: 'Link Test 1', href: 'http://hei.it'},
            { text: 'Link Test 2', href: 'http://hei.it/rai1'},
        ],
        actions: [
            { name: 'Shawn', link: 'http://hu.com'}
        ]
    };

如果我使用

querystring.stringify(body);

我回来了

 message=Hello&properties=&properties=&actions=

查询字符串是否错误或我错了?

1 个答案:

答案 0 :(得分:0)

到目前为止,我找到了一个名为node-qs的库,它输出:

消息=你好&安培;动作[0] [名称] =肖恩&安培;动作[0] [链接] = HTTP%3A%2F%2Fhei.com