Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/454.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 转义Json属性名_Javascript_Node.js_Json_Attributes_Escaping - Fatal编程技术网

Javascript 转义Json属性名

Javascript 转义Json属性名,javascript,node.js,json,attributes,escaping,Javascript,Node.js,Json,Attributes,Escaping,nodejslambda应该返回有效负载 { “状态代码”:200, “正文”:{ “客户代码”:“CCode”, “客户类型”:“客户类型” } } 请注意属性名称中的“/” 我无法在Lambda中转义此属性名称 这很有效 但不是这个 任何线索。干杯为什么没有用: 事件[“c_类型\客户类型”] exports.handler = async (event) => { // TODO implement event.ctype__customer_type =

nodejslambda应该返回有效负载

{ “状态代码”:200, “正文”:{ “客户代码”:“CCode”, “客户类型”:“客户类型” } }

请注意属性名称中的“/”

我无法在Lambda中转义此属性名称
这很有效


但不是这个

任何线索。干杯

为什么没有用:

事件[“c_类型\客户类型”]

exports.handler = async (event) => {
    // TODO implement
    event.ctype__customer_type = "Customer Type";
    const response = {
        statusCode: 200,
        body: event,
    };
    return response;
};
exports.handler = async (event) => {
    // TODO implement
    event.c_type_\/_customer_type = "Customer Type";
    const response = {
        statusCode: 200,
        body: event,
    };
    return response;
};