Skip to content

Commit

Permalink
resources consisting of an array of EObjects now also parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
dslmeinte committed Jun 11, 2014
1 parent 0cb94e2 commit 76351f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions dist/ecore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,11 +1709,14 @@ Ecore.JSON = {
return eObject;
}

var parsed = parseObject(data);
if (parsed) {
model.add(parsed);
resolveReferences();
if (_.isArray(data)) {
_.each(data, function (object) {
model.add(parseObject(object));
});
} else {
model.add(parseObject(data));
}
resolveReferences();
},

to: function(model) {
Expand Down
11 changes: 7 additions & 4 deletions src/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,14 @@ Ecore.JSON = {
return eObject;
}

var parsed = parseObject(data);
if (parsed) {
model.add(parsed);
resolveReferences();
if (_.isArray(data)) {
_.each(data, function (object) {
model.add(parseObject(object));
});
} else {
model.add(parseObject(data));
}
resolveReferences();
},

to: function(model) {
Expand Down

0 comments on commit 76351f8

Please sign in to comment.