Skip to content

Commit 096dfb6

Browse files
author
Marko Mikulicic
committed
Apply asJSON recursively
1 parent b40c86a commit 096dfb6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/field.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = Field;
44
Field.className = "Field";
55

66
var ReflectionObject = require("./object");
7+
var Message = require("./message");
78
/** @alias Field.prototype */
89
var FieldPrototype = ReflectionObject.extend(Field);
910

@@ -254,7 +255,7 @@ FieldPrototype.resolve = function resolve() {
254255

255256
if (this.long)
256257
this.defaultValue = util.Long.fromValue(this.defaultValue);
257-
258+
258259
return ReflectionObject.prototype.resolve.call(this);
259260
};
260261

@@ -279,6 +280,8 @@ FieldPrototype.jsonConvert = function(value, options) {
279280
return options.bytes === Array
280281
? Array.prototype.slice.call(value)
281282
: util.base64.encode(value, 0, value.length);
283+
else if(value instanceof Message)
284+
return value.asJSON(options);
282285
}
283286
return value;
284287
};

0 commit comments

Comments
 (0)