4 ms·
I once came up with a system that worked pretty well for an array of mostly similar objects. I use a jsonpath like column names, so putting the values A and B i
by tda 6y ago
I once came up with a system that worked pretty well for an array of mostly similar objects. I use a jsonpath like column names, so putting the values A and B in a column named "some.property.items[0]" results in
[
{"some": {"property": {"items":["A"]}}},
{"some": {"property": {"items":["B"]}}}
]
To avoid very long column names, values starting with "[" or "{" are parsed as json, so putting {"a": 1} in a column named C results in [{"C":{"a": 1}}]. Doesn't cover all edge cases, but worked well enough form my use case, which was providing a batch upload interface for a giant json (instead of a bunch of web forms) for excel savvy power users, allowing them to batch upload semi-structured data. I used jsonschema for validation on submit, worked well enough.