Synthoid/ExportSheetData

(Bug) Conflict with "Export cell arrays" and "Export cell object" on JSON array

Closed this issue · 3 comments

Bug description

When both the "Export cell arrays" and "Export cell object" features are turned on, and there's some cell with a JSON array/object, the addon get stuck, and doesn't compile
Even if "Array separator character" is set to something different than default (,)

To Reproduce

  1. Make a sheet

  2. Add a labels row

  3. In a content row, add a cell whit some JSON array in it (ex:["my", "array"])

  4. On addon side panel anable JSON -> Export cell arrays

  5. On addon side panel anable Advanced JSON -> Export cell object

  6. [optional] Change Advanced JSON -> Array separator character value to something other than , (ex: ;)

  7. Export

  8. See error: "Compiling JSON" popup won't stop loading

Expected behavior
Expected "Export cell object" have precedence, so if the cell does start with "[" it is parsed out, if does not start with it, "Export cell arrays" takes places and evaluate if there's commas (or whatever it set) to split it as array

A more platical example:

change "Array separator character" to ;
create the row (for any labels)

| my, simple, list | ["JSON", "list"] |

Expected:
{"label1": ["my, "simple", "list"], "label2":["JSON", "list"]}

Info (please complete the following information):

  • Using Chrome V86.0.4240.111 (64 bit), on Windows 10
  • Only one account signed in

Additional context
It does work with objects though

| my, simple, list | {"JSON": "list"} |

does compile:
{"label1": ["my, "simple", "list"], "label2":{"JSON": "list"}}

Hmm, good catch! I'll look into those settings this weekend and see what's going on.

This was one of those easy to fix, stupid to miss bugs. When checking a cell to see if it should be split into an array, I assumed that the value would always be a string, but it can be an object or array when exporting cell objects. This is now fixed and will roll out with the v62 release.

nice! thanks a lot for that addon, and fast fixing the bug