// 序列化JSON字符串
$.fn.serializeObject = function () {
let o = {};
let a = this.serializeArray();
$.each(a, function () {
let value = this.value;
let chain = this.name.split(".");
let c = o;
$.each(chain, function (i, e) {
if (i === (chain.length - 1)) {
if (c[e]) {
if (!c[e].push) {
c[e] = [c[e]];
}
c[e].push(value || '');
} else {
c[e] = value || '';
}
} else {
if (!c[e]) {
c[e] = {};
}
}
c = o[e];
});
});
return o;
};