Withdata Software

Convert nested JSON with nested arrays to CSV

I see a post Convert nested json with nested arrays in csv.

The poster have this JSON data:

[
  {
    "aggregate_result": [],
    "explain": "",
    "key_with_document": [
      {
        "document": {
          "creation_date": 1643342434,
          "expiration_date": 2053342527,
          "modification_date": 1643342527,
          "revision": 4,
          "struct": {
            "MatchResponse": [
              {
                "adRefId": "e6040-c8dcdb165993",
                "addrRefId": "city_list:0",
                "MatchCode": "REGI_ADDR_BLOCK",
                "maxScore": 0.9968223809704663
              },
              {
                "adRefId": "800-3c7a04dc8d3f",
                "addrRefId": "address_list:0",
                "MatchCode": "_ADDR_BLOCK",
                "maxScore": 0
              },
              {
                "adRefId": "ab39f31d-6b21-4377-9c91-85fdd345c22a",
                "addrRefId": "name_block_list:0",
                "MatchCode": "ADDR_BLOCK",
                "maxScore": 0
              }
            ],
            "MatchStatus": 200,
            "dataRefs": [
              {
                "addressRef": {
                  "addrRefId": "0",
                  "addrType": "REGISTRATION_ADDRESS",
                  "addressLine1": "123 Test Street",
                  "addressLine2": "",
                  "city": "",
                  "country": "Federation",
                  "postalCode": "12345",
                  "province": ""
                },
                "dataId": "0"
              }
            ],
            "docType": "_SCREEN",
            "extRefId1": "b326c63721536765412099",
            "extRefId1Type": "",
            "extRefId2": "",
            "extRefId2Type": "_SETTINGS",
            "ules": [
              "1213395"
            ],
            "Status": [
              "20"
            ]
          }
        },
        "key": {
          "id": [
            {
              "collection": "__ROOT__",
              "string": "3721536765412099_E"
            }
          ],
          "is_partial": false
        }
      }
    ]
  }
]

He want to convert it to CSV like this:

creation_date,expiration_date,modification_date,revision,adRefId,addrRefId,MatchCode,maxScore,struct/MatchStatus,struct/docType,struct/extRefId1,struct/extRefId1Type,struct/extRefId2,struct/extRefId2Type,struct/ules,struct/Status
1643342434,2053342527,1643342527,4,e6040-c8dcdb165993,city_list:0,REGI_ADDR_BLOCK,0.9968223809704663,200,_SCREEN,b326c63721536765412099,,,_SETTINGS,1213395,20
1643342434,2053342527,1643342527,4,800-3c7a04dc8d3f,address_list:0,_ADDR_BLOCK,0,200,_SCREEN,b326c63721536765412099,,,_SETTINGS,1213395,20
1643342434,2053342527,1643342527,4,ab39f31d-6b21-4377-9c91-85fdd345c22a,name_block_list:0,ADDR_BLOCK,0,200,_SCREEN,b326c63721536765412099,,,_SETTINGS,1213395,20

I wonder if DataFileConverter can do this. So I test. Yes, it can convert nested JSON with nested arrays to CSV, in a minute.

1. Open JSON file in DataFileConverter, set JSON options.

2. Set CSV options.

3. “Next” and “Next”, convert, get CSV file.