How it works
Converting to CSV collects every column name across all objects, then writes one header row followed by one row per object, quoting a value whenever it contains a comma, quote, or newline. Converting back parses the CSV character by character rather than line by line, so a quoted field spanning multiple lines is not mistaken for multiple rows.
Handling uneven rows
If some objects are missing a key that others have, the resulting CSV still gets one column for it — rows without that key just get an empty cell rather than the whole conversion failing.
Limitations
This expects a flat array of objects. Nested objects or arrays inside a row are converted to their JSON text representation rather than being split into further columns, since CSV has no native way to represent nested structure.