9 ms·
Haha I did something similar at my company. Our customers are heavy spreadsheet users, so decided to create a generic Angular component that can take semi-arbit
by janee 7y ago
Haha I did something similar at my company. Our customers are heavy spreadsheet users, so decided to create a generic Angular component that can take semi-arbitrary json and display it in a spreadsheet (handsontable).
The code flattens a deeply nested json object into a bunch of 'rows', similar to Spark's explode or Mongo's unwind.
The objects representing the flattend rows have their getters and setters hooked to the original json object. That way when you edit the spreadsheet the json is automatically updated, with parent values shown as merged cells for array child values.
The code was completely bonkers and I ripped it out later...but must say it was fun to write and see it doing its thing