How to parse complex response body in schedule job

s r1
Tera Contributor
Response body from third party tool to ServiceNow:
{
    "database": {
        "allSheets": {
            "facts": [
                {
                    "cluster": {
                        "name": "Oracle",
                        "description": "This is used by db team.",
                        "Type": "database",
                        "Hosting": "Saas",
                        "life": {
                            "state": "Operational"
                        },
               
"rel1": {
                            "totalCount": 4,
                            "edges": [
                                {
                                    "node": {
                                        "Sheet": {
                                            "name1": "problem",
                                            "description": null
                                        }
                                    }
                                },
                                {
                                    "node": {
                                        "Sheet": {
                                            "name1": "incident,
                                            "description": null
                                        }
                                    }
                                },
                                {
                                    "node": {
                                        "Sheet": {
                                            "name1": "Supply chain" ,
                                            "description": null
                                        }
                                    }
                                },
                                {
                                    "node": {
                                        "Sheet": {
                                            "name1": "inovation",
                                            "description": null
                                        }
                                    }
                                }
                            ]
                        },
                        "Owner": {
                            "totalCount": 2,
                            "edges": [
                                {
                                    "node": {
                                        "user": {
                                   "userName": "abc@gmail.com"
                                        },
                                        "type": "OBSERVER",
                                        "roles": [
                                            {
                                                "name": "Architect"
                                            }
                                        ]
                                    }
                                },
                                {
                                    "node": {
                                        "user": {
                                            "userName": "xyz@gmail.com"
                                        },
                                        "otype": "RESPONSIBLE",
                                        "roles": [
                                            {
                                                "name": "Developer"
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                },
                {
                    "cluster": {
                        "name": "Adobe",
                        "description": "Adobe.",
                     "Type": "database",
                        "Hosting": "Saas",
                        "life": {
                            "state": "Operational"
                        },
                        "subscriptions": {
                            "totalCount": 0,
                            "edges": []
                        }
                    }
                },
 
above response to be parsed and each record to be added in ServiceNow Custom table 
 
FieldValue
nameOracle
descriptionThis is used by db team.
Typedatabase
HostingSaas
lifeOperational
rel1problem
 incident
Ownerxyz@gmail.com 
otypeRESPONSIBLE
workDeveloper
1 REPLY 1

Pranav_Thanedar
Mega Sage

Hi @s r1 ,

 

Can you please explain the complete setup here? Have you setup a REST data source? or do you want to handle this response in scheduled script execution?

 

Regards,

Pranav Thanedar