Skip to main content
Question

JSON colum list/ Row list to CSV

  • October 21, 2022
  • 1 reply
  • 42 views

Forum|alt.badge.img

Hi, i failed to convert this format to an CSV with header

 

Has anyone seen this type of structure before?

Thanks for all

{
    "nbResults": "2",
    "columnList": [
        "THE_LIBELLE",
        "THE_ACTIF",
        "THE_DT_CREA",
        "THE_UTIL_CREA",
        "THE_DT_DERN_MAJ",
        "THE_UTIL_DERN_MAJ",
        "THE_ORDRE"
    ],
    "keyList": [
        "THE_ID"
    ],
    "rowList": [
        {
            "columnDataList": [
                "Commercial",
                "1",
                "11/10/2022 18:15",
                "Test X",
                "11/10/2022 18:15",
                "Test Y",
                "1"
            ],
            "keyDataList": [
                "1"
            ]
        },
        {
            "columnDataList": [
                "Culturelle",
                "1",
                "11/10/2022 18:15",
                "Test X",
                "11/10/2022 18:15",
                "Test Y",
                "2"
            ],
            "keyDataList": [
                "2"
            ]
        }
    ]
}

1 reply

david_r
Celebrity
  • October 21, 2022

The easiest may be to read the file using the Text File reader (make sure to configure it to read the whole file at once) and then use a couple of JSONFragmenters to extract the schema definition ("columnList") and/or the table contents ("rowList").

For example to extract the table contents:

imageGives you:

imageIf the schema is always the same, you could skip reading the schema definition and simply use something like an AttributeManager to rename the list items as needed, e.g.

imageIf the schema can differ and the workspace needs to be fully dynamic, it's going to be more complicated ;-)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings