Synthoid / ExportSheetData

Add-on for Google Sheets that allows data to be exported as JSON or XML.
MIT License
237 stars 46 forks source link

I have some problems with Nested elements #87

Open mikelga opened 5 years ago

mikelga commented 5 years ago

Hello!

I want to create the following JSON using Google Sheets:

{
    "name01": {
        "value": {
            "description": "name01_description",
            "factor": {
                "factor01": 10
            },
            "params": {
                "integral": 1,
                "integral_sum": 1,
                "offset": 1
            },
        }
    "name02": {
        "value": {
            "description": "name02_description",
            "factor": {
                "factor01": 20
            },
            "params": {
                "integral": 2,
                "integral_sum": 2,
                "offset": 2
            },
        }
    "name03": {
        "value": {
            "description": "name03_description",
            "factor": {
                "factor01": 30
            },
            "params": {
                "integral": 3,
                "integral_sum": 3,
                "offset": 3
            },
        }
    },
}

I have read the documentation of https://github.com/Synthoid/ExportSheetData/wiki/Nested-Elements#using-nested-elements but I can not get my solution.

This is the answer that I receive: { "Sheet1": [ { "value": { "description": "name01_description", "factor": { "factor01": 10 }, "params": { "integral": 1, "integral_sum": 1, "offset": 1 } } }, { "value": { "description": "name02_description", "factor": { "factor01": 20 }, "params": { "integral": 2, "integral_sum": 2, "offset": 2 } } }, { "value": { "description": "name03_description", "factor": { "factor01": 30 }, "params": { "integral": 3, "integral_sum": 3, "offset": 3 } } } ] }

I have selected this configuration: (Y) Nested Elements (Y) Nested Array prefix (NA_) The name of the sheet: NA_Sheet1

image

Thanks for yout help!

mikelga commented 5 years ago

The document: https://drive.google.com/open?id=1s8pS5XIhLCUj8V09sA_jABi_rxkuKpf1D1jNCBLWOMM

mikelga commented 5 years ago

Hi @Synthoid ! Do you know if it's possible to create that JSON? Thank you very much!

Synthoid commented 5 years ago

Sorry for the delayed response. I'm in the middle of a crunch period currently, so I haven't had a lot of free time to look at this. Currently, the JSON you want cannot be exactly matched, but the same data can be exported with slightly different formatting. This format would export each row as a distinct element in an array instead of elements in a JSON object. You're on the right track for that, but you need to have a key in every column (columns without keys are not exported).

Nested Elements are still very rough around the edges, so there is definitely work to be done there on my end. Unfortunately I won't be able to do much until next week at the earliest.

almazangc commented 2 years ago

Is there a solution on how to set up like that already sir? "id" : { "name": "", "icon": "", "voice": "", "text": [""], "choices": [ {"text" : "", "next" : "", "action": [], "show_only_if": ""}, {"text" : "", "next" : "", "action": [], "show_only_if": ""} ], "action" : [], "next": [{"id": "", "if": ""}, {"id": "", "if": ""}, "default_id"], }