From 096dfb686f88db38ed2d8111ed7aac36f8ba658a Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Thu, 15 Dec 2016 18:24:26 +0100 Subject: [PATCH] Apply asJSON recursively --- src/field.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/field.js b/src/field.js index 37c2e6503..f6f4d0805 100644 --- a/src/field.js +++ b/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; };