Improve flatten
This commit is contained in:
parent
88fd79757b
commit
d98ebab393
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user