News for hackers. Stuff that matters.
Re:Representing and Editing JSON with Spreadsheets (2018) by tda on Monday January 25, 2021 @09:59AM (#25903841)
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.

There are no comments on this comment yet.