String k = keys.next();
Object v = params.get(k);
if (v instanceof LegacyParams) {
v = ((LegacyParams) v).getValues();
} else if (v instanceof ModelData) {
v = new LegacyParams(((ModelData) v).getProperties()).getValues();
}
obj.set(k, v);
}
return obj.getJsObject();
}