Permalink
Browse files

Apply asJSON recursively

  • Loading branch information...
mkmik committed Dec 15, 2016
1 parent b40c86a commit 096dfb686f88db38ed2d8111ed7aac36f8ba658a
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/field.js
@@ -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);
@@ -254,7 +255,7 @@ FieldPrototype.resolve = function resolve() {
if (this.long)
this.defaultValue = util.Long.fromValue(this.defaultValue);
return ReflectionObject.prototype.resolve.call(this);
};
@@ -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.