Closed wheelercj closed 3 months ago
We decided to use one simple format for all JSON output.
a | b | c |
---|---|---|
d | e | f |
g | h | i |
[{"a": ["b", "c"]}, {"d": ["e", "f"]}, {"g": ["h", "i"]}]
This will replace the current array of arrays format and be the only format for JSON output for the time being. It solves the problem of duplicate property names without changing any property names and makes the data easy to work with in the way it is most commonly used: iterating through the elements in each row. A new setting will be added to the options page: "Empty table cells are converted to ___ in JSON" (a text input field that defaults to null).
More JSON format options may be added in the future.
Stardown's latest commits already support copying tables as 2D JSON arrays, but sometimes it might be more helpful to copy tables as JSON objects instead.
However, there are several formats possible. I'm not sure which one(s) to add support for yet and would like feedback from others.
{"a": ["d", "g"], "b": ["e", "h"], "c": ["f", "i"]}
(columns){"a": ["b", "c"], "d": ["e", "f"], "g": ["h", "i"]}
(rows)Copy JSON of table
, which creates a 2D array unless the table has a header row (created with<th>
elements) and/or a header column, in which case the option creates an object. If there is both a header row and a header column, the header row is used as the property names.Copy JSON arrays of table
andCopy JSON object of table
. The object option looks for a header row or header column for the property names, preferring a header row and using the top row if there are no<th>
elements.Copy JSON arrays of table
,Copy JSON columns object of table
, andCopy JSON rows object of table
. Whether there are<th>
elements does not matter.Note that some tables have cells that span multiple rows, such as this one: HTML table advanced features and accessibility - Learn web development | MDN. That table also has multiple header rows and multiple header columns.
(1)
, or whatever the next unique number is, to its contents?For example:
{"a": ["c"], "a (1)": ["d"], "a (2)": ["e"], "b": ["f"]}
{"59": [35, 11], "true": [false, true], "null": [null, "orange"]}
related
97