Parsing nested array into a Json

Parsing nested array into a Json

Hello, 

I have some inquires I would like to make in reference to the code below,

We are using Blancco API, to populate reports from Blancco into our form, after mapping out the key values, we are using the get() function to populate the data;

Example1: If I wanted to get "date" value nested in the "document_log" array, nested in the "description" json object, nested in the "blancco_data" json object, nested in the "reports" array, nested in json.

The code below;

description_date = reports.get(0).get("blancco_data").get("description").get("document_log").get(0).get("date");

Example 2; If I wanted to get "erasure_details"

The code below:
erasure_details = erasure.get(8).get("erasure_details");

The code works, but these are when the values are static, but if new json fields are inputted, it would return empty, is there a way to make it Dynamic?

Here, is the full code;

{
  "reports": [
    {
      "blancco_data": {
        "description": {
          "document_id": "Redacted",
          "document_log": [
            {
              "author": {
                "product_name": {
                  "@id": "Redacted",
                  "@name": "Redacted",
                  "value": "Redacted"
                },
                "product_version": "Redacted",
                "product_revision": "Redacted"
              },
              "date": "2024-04-24T10:26:08+0000",
              "clock_source": "Redacted"
            }
          ]
        },
        "blancco_erasure_report": {
          "erasures": [
            {
              "erasure": [
                {
                  "@type": "uint",
                  "erasure_id": 1
                },
                {
                  "@type": "string",
                  "timestamp": "2024-04-24T10:26:08+0000"
                },
                {
                  "target": [
                    {
                      "@type": "uint",
                      "target_id": 2
                    },
                    {
                      "@type": "uint",
                      "internal_id": 47
                    }
                  ]
                },
                {
                  "@type": "uint",
                  "processed_sectors": 1234567890
                },
                {
                  "@type": "uint",
                  "unprocessed_sectors": 0
                },
                {
                  "@type": "uint",
                  "excluded_sectors": 0
                },
                {
                  "@type": "uint",
                  "total_errors": 0
                },
                {
                  "@type": "string",
                  "state": "Successful"
                },
                {
                  "erasure_details": [
                    {
                      "information": [
                        {
                          "@type": "uint",
                          "message_id": 123
                        },
                        {
                          "@type": "string",
                          "message": "Redacted"
                        }
                      ]
                    },
                    {
                      "messages": [
                        {
                          "@type": "uint",
                          "message_id": 123
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  ]
}
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方