游客
2024年03月
2021年08月
暂无此功能
可以直接在文件里编写如下代码注释
/*
提取出 JSON 中有值字段或者不为Null的字段,并生成新的对象。
data.json 文件中的示例数据
{
"Number": "20240312145331792WBA",
"Organ": null,
"Lzfpbz": "0",
"InfoKind": "02",
"Tdys": null,
"CezslxDm": null
}
*/
const handleJson
会生成正确的函数
const handleJson = (data) => {
const result = {};
Object.keys(data).forEach(key => {
if (data[key] !== null && data[key] !== undefined) {
result[key] = data[key];
}
});
return result;
};
export default handleJson;