Skip to content

Commit

Permalink
Apply asJSON recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Mikulicic committed Dec 15, 2016
1 parent b40c86a commit 096dfb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = Field;
Field.className = "Field";

var ReflectionObject = require("./object");
var Message = require("./message");
/** @alias Field.prototype */
var FieldPrototype = ReflectionObject.extend(Field);

Expand Down Expand Up @@ -254,7 +255,7 @@ FieldPrototype.resolve = function resolve() {

if (this.long)
this.defaultValue = util.Long.fromValue(this.defaultValue);

return ReflectionObject.prototype.resolve.call(this);
};

Expand All @@ -279,6 +280,8 @@ FieldPrototype.jsonConvert = function(value, options) {
return options.bytes === Array
? Array.prototype.slice.call(value)
: util.base64.encode(value, 0, value.length);
else if(value instanceof Message)
return value.asJSON(options);
}
return value;
};

0 comments on commit 096dfb6

Please sign in to comment.