Open Garfield1002 opened 1 year ago
Corresponding issue: https://github.com/Synthoid/ExportSheetData/issues/151
A new header type surrounded with [{}]. This will create a new object names after the cell content rather than the column title.
We can now address the issue raised in 151 with this new header
Outcome (All examples are done with only the Nested Elements options enabled):
{ "Sheet1": { "Class A": { "PSIPL": 9, "SMCSLU": 2 }, "Class B": { "PSIPL": 6, "SMCSLU": 4 }, "Class C": { "PSIPL": 4, "SMCSLU": 6 }, "Class D": { "PSIPL": 3, "SMCSLU": 8 }, "Class E": { "PSIPL": 1, "SMCSLU": 10 } } }
We can take this a step further and are able to rework the advanced country example to now include different objects as well as lists
Output
{ "Sheet1": { "North America": { "Canada": { "Cities": [ { "Name": "Toronto", "Population": 2615000 }, { "Name": "Vancouver", "Population": 603500 }, { "Name": "Montreal", "Population": 1650000 } ] }, "United States": { "Cities": [ { "Name": "New York", "Population": 8273000 }, { "Name": "Chicago", "Population": 2697000 }, { "Name": "Los Angeles", "Population": 3849000 } ] } } } }
Dict
SubpathTypes
getSubpathTypeJson
getKeyPath
trimKeySubpath
exportSpreadsheetJson
A proposed solution for using dictionaries with nested objects
Corresponding issue: https://github.com/Synthoid/ExportSheetData/issues/151
Implemented solution
A new header type surrounded with [{}]. This will create a new object names after the cell content rather than the column title.
Usage
We can now address the issue raised in 151 with this new header
Outcome (All examples are done with only the Nested Elements options enabled):
Advantages
We can take this a step further and are able to rework the advanced country example to now include different objects as well as lists
Output
Code changes
Dict
toSubpathTypes
and changedgetSubpathTypeJson
to accomodate this new headergetKeyPath
andtrimKeySubpath
to accomodate for the 2 character identifierexportSpreadsheetJson