Skip to content

Commit

Permalink
Merge pull request #561 from mmikulicic/master
Browse files Browse the repository at this point in the history
Apply asJSON recursively
  • Loading branch information
dcodeIO authored Dec 15, 2016
2 parents b40c86a + 096dfb6 commit 8d7bb1f
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 8d7bb1f

Please sign in to comment.