Improve flatten

This commit is contained in:
Crow Crowcrow 2018-05-03 15:07:54 +02:00
parent 88fd79757b
commit d98ebab393
Signed by: Crow
GPG Key ID: 45A8E203AF859FD8

View File

@ -80,6 +80,7 @@ class Serializer {
this.parent;
this._fields = new Map();
this.min = Number(element.getAttribute("min") || -1);
this.flatten = element.hasAttribute("flatten")
this.required = element.getAttribute("required") !== null || this.min != -1;
@ -174,7 +175,7 @@ class Serializer {
}
if(k == "") {
if(f[key].flatten){
if(f[key].flatten || this.flatten){
json[key].push(d);
} else {
json[key] = d;
@ -183,7 +184,7 @@ class Serializer {
continue
}
if(f[key].flatten){
if(f[key].flatten || this.flatten){
json[k].push(d);
continue;
}