Rewrote flatten_json schematics