diff --git a/packages/concerto-core/lib/serializer/jsongenerator.js b/packages/concerto-core/lib/serializer/jsongenerator.js index 85fad1f8a..8ea4157f2 100644 --- a/packages/concerto-core/lib/serializer/jsongenerator.js +++ b/packages/concerto-core/lib/serializer/jsongenerator.js @@ -106,7 +106,7 @@ class JSONGenerator { parameters.stack.push(value); const jsonValue = decl.accept(this, parameters); - value = JSON.stringify(jsonValue); + value = jsonValue; } map.set(key, value); diff --git a/packages/concerto-core/lib/serializer/jsonpopulator.js b/packages/concerto-core/lib/serializer/jsonpopulator.js index 734b2494a..891bf9c37 100644 --- a/packages/concerto-core/lib/serializer/jsonpopulator.js +++ b/packages/concerto-core/lib/serializer/jsonpopulator.js @@ -220,7 +220,7 @@ class JSONPopulator { let subResource = parameters.factory.newConcept(decl.getNamespace(), decl.getName(), decl.getIdentifierFieldName() ); - parameters.jsonStack.push(JSON.parse(value)); + parameters.jsonStack.push(value); parameters.resourceStack.push(subResource); return decl.accept(this, parameters); } diff --git a/packages/concerto-core/test/serializer/maptype/serializer.js b/packages/concerto-core/test/serializer/maptype/serializer.js index 0c3d8456e..0ee70d125 100644 --- a/packages/concerto-core/test/serializer/maptype/serializer.js +++ b/packages/concerto-core/test/serializer/maptype/serializer.js @@ -383,8 +383,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', rolodex: { $class: 'org.acme.sample.Rolodex', - 'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}', - 'London': '{"$class":"org.acme.sample.Person","name":"Alice"}' + 'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'}, + 'London': {'$class':'org.acme.sample.Person','name':'Alice'} } }); @@ -514,8 +514,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', directory: { $class: 'org.acme.sample.Directory', - 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}', - '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}', + 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'}, + '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'}, } }); @@ -805,8 +805,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', rolodex: { $class: 'org.acme.sample.Rolodex', - 'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}', - 'London': '{"$class":"org.acme.sample.Person","name":"Alice"}' + 'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'}, + 'London': {'$class':'org.acme.sample.Person','name':'Alice'} } }; @@ -830,8 +830,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', rolodex: { $class: 'org.acme.sample.Rolodex', - 'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}', - 'London': '{"$class":"org.acme.sample.Person","name":"Alice"}' + 'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'}, + 'London': {'$class':'org.acme.sample.Person','name':'Alice'} } }); }); @@ -941,8 +941,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', directory: { $class: 'org.acme.sample.Directory', - 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}', - '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}', + 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'}, + '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'}, } }; @@ -964,8 +964,8 @@ describe('Serializer', () => { $class: 'org.acme.sample.Concepts', directory: { $class: 'org.acme.sample.Directory', - 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}', - '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}', + 'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'}, + '9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'}, } }); });