diff --git a/weichatPb/src/converter.js b/weichatPb/src/converter.js index 67e1f60..61d11b1 100644 --- a/weichatPb/src/converter.js +++ b/weichatPb/src/converter.js @@ -299,7 +299,7 @@ converter.toObject = function toObject(mtype){ if (!hasKs2){ hasKs2 = true; } - if (m[propName]&&(ks2 = Object.keys(m[propName]).length)){ + if (m[propName]&&(ks2 = Object.keys(m[propName]))){ d[propName] = {}; for (j = 0; j < ks2.length; ++j){ valuePartial_toObject(field, index, propName, util.merge(util.copy(options), {m:m,d:d,ksi :ks2[j],o:o})); diff --git a/weichatPb/src/decoder.js b/weichatPb/src/decoder.js index 7443b40..409c569 100644 --- a/weichatPb/src/decoder.js +++ b/weichatPb/src/decoder.js @@ -52,9 +52,9 @@ function decoder(mtype){ } }else { if(types.basic[type] == undefined){ - m[name] = _types[i].decode(r, r.uint32()); + m[name][typeof k ==='object' ? _util.longToHash(k):k] = _types[i].decode(r, r.uint32()); }else { - m[name] = r[type](); + m[name][typeof k ==='object' ? _util.longToHash(k):k] = r[type](); } } }else if(field.repeated){