JSON to DB/CDT/Record

Certified Associate Developer

Hello Appian Community,

I've been given a somewhat complex JSON format to ingest into Appian and stage all the data into the DB.  The intention of the data is for reference/comparison/reporting.  I've tested the regular readtextfromfile/fromJson/jsonPath functions to grab each attribute but it feels very tedious/clunky to have an JSON path expression for ever attribute I need.  Could I get any advice on a more efficient way to parse this data and get it in the DB?

Data Context:

One JSON will have thousands of "FullProduct" entities so I will be dealing with files with a size of at most 25MB.  This structure is the final format so there is no altering the original file.

JSON Sample:

{
    "FULLPRODUCTFILE": [
        {
            "FullProduct": {
                "ID": "*dfg333",
                "Details": {
                    "StatusType": "LIVE",
                    "Status": "ACTIVE"
                },
                "Classification": [
                    {
                        "ID": "aaa111",
                        "Classification": {
                            "Class": {
                                "ClassificationID": "ASDAFF",
                                "ClassName": "Article 8",
                                "ClassDescription": "Description",
                                "ClassValue": "ARTICLE8"
                            }
                        },
                        "ClassificationPurpose": "Purpose2"
                    },
                    {
                        "ID": "aaa222",
                        "Classification": {
                            "Class": {
                                "ClassificationID": "EETEWTT",
                                "ClassName": "Article 2",
                                "ClassDescription": "Description",
                                "ClassValue": "ARTICLE2"
                            }
                        },
                        "ClassificationPurpose": "Purpose"
                    }
                ],
                "Meetings": [
                    {
                        "ID": "dfgd22f",
                        "MeetingNumber": 2333,
                        "MeetingDate": "2024-12-18T12:00:00.000",
                        "MeetingDepartment": "DEPARTMENT 1",
                        "MeetingComment": "test"
                    }
                ],
                "Case": {
                    "CaseDocument": "Document URL",
                    "CaseDocumentDate": "2024-12-18T12:20:57.000"
                },
                "AllMarks": [
                    {
                        "ID": "hfhgsgfh",
                        "MarksType": "Primary",
                        "Marks": {
                            "MarkDetails": {
                                "MarkName": "TEST_NAME",
                                "MarkType": "TYPE",
                                "MarkDocument": {
                                    "MarkDocName": "TEST1"
                                },
                                "MarkNotes": {
                                    "MarkComment": "Test COMMENT"
                                }
                            }
                        }
                    }
                ],
                "Rules": {
                    "RuleYear": "2024",
                    "RuleSet": 2
                }
            }
        }
    ]
}

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    According to my understanding, parsing data in Appian can be an efficient way to save information. While this approach may require some effort, it is worth pursuing. Constructing Common Data Types (CDTs) with the parsed data and saving it would be a good strategy. The below code gives you data in Appian

    format. from there you can construct your CDT structures. and using wirteDatastorenetity and save it

    a!localVariables(
      
      local!jsonData: readtextfromfile(
        txtFile: ri!doc, 
        preserveLineBreaks:true()),
    
        
        local!parsedData: a!fromJson(local!jsonData),
        
      
    )

Reply
  • 0
    Certified Senior Developer

    According to my understanding, parsing data in Appian can be an efficient way to save information. While this approach may require some effort, it is worth pursuing. Constructing Common Data Types (CDTs) with the parsed data and saving it would be a good strategy. The below code gives you data in Appian

    format. from there you can construct your CDT structures. and using wirteDatastorenetity and save it

    a!localVariables(
      
      local!jsonData: readtextfromfile(
        txtFile: ri!doc, 
        preserveLineBreaks:true()),
    
        
        local!parsedData: a!fromJson(local!jsonData),
        
      
    )

Children