Chilkat Online Tools

ListAnomaliesForInsight unicodeCpp Example

Amazon DevOps Guru

#include <CkRestW.h>
#include <CkAuthAwsW.h>
#include <CkJsonObjectW.h>
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkRestW rest;
    bool success;

    CkAuthAwsW authAws;
    authAws.put_AccessKey(L"AWS_ACCESS_KEY");
    authAws.put_SecretKey(L"AWS_SECRET_KEY");

    // Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
    authAws.put_Region(L"us-west-2");
    authAws.put_ServiceName(L"devops-guru");
    // SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    rest.SetAuthAws(authAws);

    // URL: https://devops-guru.us-west-2.amazonaws.com/
    // Use the same region as specified above.
    success = rest.Connect(L"devops-guru.us-west-2.amazonaws.com",443,true,true);
    if (success != true) {
        wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    // The following code creates the JSON request body.
    // The JSON created by this code is shown below.

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    CkJsonObjectW json;
    json.UpdateString(L"AccountId",L"string");
    json.UpdateInt(L"MaxResults",123);
    json.UpdateString(L"NextToken",L"string");
    json.UpdateInt(L"StartTimeRange.FromTime",123);
    json.UpdateInt(L"StartTimeRange.ToTime",123);

    // The JSON request body created by the above code:

    // {
    //   "AccountId": "string",
    //   "MaxResults": number,
    //   "NextToken": "string",
    //   "StartTimeRange": {
    //     "FromTime": number,
    //     "ToTime": number
    //   }
    // }

    rest.AddHeader(L"Content-Type",L"application/x-amz-json-1.1");
    rest.AddHeader(L"X-Amz-Target",L"ListAnomaliesForInsight");

    CkStringBuilderW sbRequestBody;
    json.EmitSb(sbRequestBody);
    CkStringBuilderW sbResponseBody;
    success = rest.FullRequestSb(L"POST",L"/anomalies/insight/{InsightId}",sbRequestBody,sbResponseBody);
    if (success != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    int respStatusCode = rest.get_ResponseStatusCode();
    wprintf(L"response status code = %d\n",respStatusCode);
    if (respStatusCode != 200) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",rest.responseHeader());
        wprintf(L"Response Body:\n");
        wprintf(L"%s\n",sbResponseBody.getAsString());
        return;
    }

    CkJsonObjectW jResp;
    jResp.LoadSb(sbResponseBody);

    // The following code parses the JSON response.
    // A sample JSON response is shown below the sample code.

    // Use this online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
    // See this example explaining how this memory should be used: const char * functions.

    int CloseTime;
    int OpenTime;
    int EndTime;
    int StartTime;
    const wchar_t *AssociatedInsightId = 0;
    const wchar_t *Id = 0;
    int Limit;
    int PredictionTimeRangeEndTime;
    int PredictionTimeRangeStartTime;
    const wchar_t *Severity = 0;
    const wchar_t *Source = 0;
    const wchar_t *SourceResourceName = 0;
    const wchar_t *SourceResourceType = 0;
    const wchar_t *Status = 0;
    int UpdateTime;
    int j;
    int count_j;
    const wchar_t *Name = 0;
    const wchar_t *v_Type = 0;
    const wchar_t *strVal = 0;
    const wchar_t *AppBoundaryKey = 0;
    int k;
    int count_k;
    const wchar_t *StatusCode = 0;
    const wchar_t *MetricName = 0;
    const wchar_t *Namespace = 0;
    int Period;
    const wchar_t *Stat = 0;
    const wchar_t *Unit = 0;
    const wchar_t *Value = 0;
    int MetricValue;
    int Timestamp;
    const wchar_t *MetricDisplayName = 0;
    const wchar_t *v_String = 0;
    const wchar_t *Group = 0;
    int GroupByLimit;
    const wchar_t *Metric = 0;
    const wchar_t *FilterString = 0;
    const wchar_t *GroupByGroup = 0;
    const wchar_t *MetricQueryMetric = 0;
    int ReferenceScalarValue;
    CkJsonObjectW *json1 = 0;
    int i1;
    int count_i1;
    int Value_int;
    int AnomalyReportedTimeRangeCloseTime;
    int AnomalyReportedTimeRangeOpenTime;
    int AnomalyTimeRangeEndTime;
    int AnomalyTimeRangeStartTime;
    const wchar_t *CausalAnomalyId = 0;
    const wchar_t *Description = 0;
    const wchar_t *MetricDataSummaryStatusCode = 0;

    const wchar_t *NextToken = jResp.stringOf(L"NextToken");
    int i = 0;
    int count_i = jResp.SizeOfArray(L"ProactiveAnomalies");
    while (i < count_i) {
        jResp.put_I(i);
        CloseTime = jResp.IntOf(L"ProactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime");
        OpenTime = jResp.IntOf(L"ProactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime");
        EndTime = jResp.IntOf(L"ProactiveAnomalies[i].AnomalyTimeRange.EndTime");
        StartTime = jResp.IntOf(L"ProactiveAnomalies[i].AnomalyTimeRange.StartTime");
        AssociatedInsightId = jResp.stringOf(L"ProactiveAnomalies[i].AssociatedInsightId");
        Id = jResp.stringOf(L"ProactiveAnomalies[i].Id");
        Limit = jResp.IntOf(L"ProactiveAnomalies[i].Limit");
        PredictionTimeRangeEndTime = jResp.IntOf(L"ProactiveAnomalies[i].PredictionTimeRange.EndTime");
        PredictionTimeRangeStartTime = jResp.IntOf(L"ProactiveAnomalies[i].PredictionTimeRange.StartTime");
        Severity = jResp.stringOf(L"ProactiveAnomalies[i].Severity");
        Source = jResp.stringOf(L"ProactiveAnomalies[i].SourceMetadata.Source");
        SourceResourceName = jResp.stringOf(L"ProactiveAnomalies[i].SourceMetadata.SourceResourceName");
        SourceResourceType = jResp.stringOf(L"ProactiveAnomalies[i].SourceMetadata.SourceResourceType");
        Status = jResp.stringOf(L"ProactiveAnomalies[i].Status");
        UpdateTime = jResp.IntOf(L"ProactiveAnomalies[i].UpdateTime");
        j = 0;
        count_j = jResp.SizeOfArray(L"ProactiveAnomalies[i].AnomalyResources");
        while (j < count_j) {
            jResp.put_J(j);
            Name = jResp.stringOf(L"ProactiveAnomalies[i].AnomalyResources[j].Name");
            v_Type = jResp.stringOf(L"ProactiveAnomalies[i].AnomalyResources[j].Type");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames");
        while (j < count_j) {
            jResp.put_J(j);
            strVal = jResp.stringOf(L"ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ProactiveAnomalies[i].ResourceCollection.Tags");
        while (j < count_j) {
            jResp.put_J(j);
            AppBoundaryKey = jResp.stringOf(L"ProactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey");
            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues");
            while (k < count_k) {
                jResp.put_K(k);
                strVal = jResp.stringOf(L"ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics");
        while (j < count_j) {
            jResp.put_J(j);
            StatusCode = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode");
            MetricName = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName");
            Namespace = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace");
            Period = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period");
            Stat = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat");
            Unit = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit");
            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions");
            while (k < count_k) {
                jResp.put_K(k);
                Name = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name");
                Value = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList");
            while (k < count_k) {
                jResp.put_K(k);
                MetricValue = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue");
                Timestamp = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics");
        while (j < count_j) {
            jResp.put_J(j);
            MetricDisplayName = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName");
            v_String = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string");
            Group = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group");
            GroupByLimit = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit");
            Metric = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric");
            Unit = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit");
            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions");
            while (k < count_k) {
                jResp.put_K(k);
                strVal = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData");
            while (k < count_k) {
                jResp.put_K(k);
                FilterString = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string");
                GroupByGroup = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group");
                GroupByLimit = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit");
                MetricQueryMetric = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric");
                ReferenceScalarValue = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value");
                Name = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name");

                json1 = jResp.ObjectOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]");
                i1 = 0;
                count_i1 = json1->SizeOfArray(L"ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions");
                while (i1 < count_i1) {
                    json1->put_I(i1);
                    strVal = json1->stringOf(L"ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]");
                    i1 = i1 + 1;
                }

                delete json1;
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly");
            while (k < count_k) {
                jResp.put_K(k);
                v_Type = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type");
                Value_int = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline");
            while (k < count_k) {
                jResp.put_K(k);
                v_Type = jResp.stringOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type");
                Value_int = jResp.IntOf(L"ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"ReactiveAnomalies");
    while (i < count_i) {
        jResp.put_I(i);
        AnomalyReportedTimeRangeCloseTime = jResp.IntOf(L"ReactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime");
        AnomalyReportedTimeRangeOpenTime = jResp.IntOf(L"ReactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime");
        AnomalyTimeRangeEndTime = jResp.IntOf(L"ReactiveAnomalies[i].AnomalyTimeRange.EndTime");
        AnomalyTimeRangeStartTime = jResp.IntOf(L"ReactiveAnomalies[i].AnomalyTimeRange.StartTime");
        AssociatedInsightId = jResp.stringOf(L"ReactiveAnomalies[i].AssociatedInsightId");
        CausalAnomalyId = jResp.stringOf(L"ReactiveAnomalies[i].CausalAnomalyId");
        Description = jResp.stringOf(L"ReactiveAnomalies[i].Description");
        Id = jResp.stringOf(L"ReactiveAnomalies[i].Id");
        Name = jResp.stringOf(L"ReactiveAnomalies[i].Name");
        Severity = jResp.stringOf(L"ReactiveAnomalies[i].Severity");
        Status = jResp.stringOf(L"ReactiveAnomalies[i].Status");
        v_Type = jResp.stringOf(L"ReactiveAnomalies[i].Type");
        j = 0;
        count_j = jResp.SizeOfArray(L"ReactiveAnomalies[i].AnomalyResources");
        while (j < count_j) {
            jResp.put_J(j);
            Name = jResp.stringOf(L"ReactiveAnomalies[i].AnomalyResources[j].Name");
            v_Type = jResp.stringOf(L"ReactiveAnomalies[i].AnomalyResources[j].Type");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames");
        while (j < count_j) {
            jResp.put_J(j);
            strVal = jResp.stringOf(L"ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ReactiveAnomalies[i].ResourceCollection.Tags");
        while (j < count_j) {
            jResp.put_J(j);
            AppBoundaryKey = jResp.stringOf(L"ReactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey");
            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues");
            while (k < count_k) {
                jResp.put_K(k);
                strVal = jResp.stringOf(L"ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics");
        while (j < count_j) {
            jResp.put_J(j);
            MetricDataSummaryStatusCode = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode");
            MetricName = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName");
            Namespace = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace");
            Period = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period");
            Stat = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat");
            Unit = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit");
            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions");
            while (k < count_k) {
                jResp.put_K(k);
                Name = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name");
                Value = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList");
            while (k < count_k) {
                jResp.put_K(k);
                MetricValue = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue");
                Timestamp = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics");
        while (j < count_j) {
            jResp.put_J(j);
            MetricDisplayName = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName");
            FilterString = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string");
            GroupByGroup = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group");
            GroupByLimit = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit");
            MetricQueryMetric = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric");
            Unit = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit");
            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions");
            while (k < count_k) {
                jResp.put_K(k);
                strVal = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData");
            while (k < count_k) {
                jResp.put_K(k);
                FilterString = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string");
                GroupByGroup = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group");
                GroupByLimit = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit");
                MetricQueryMetric = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric");
                ReferenceScalarValue = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value");
                Name = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name");

                json1 = jResp.ObjectOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]");
                i1 = 0;
                count_i1 = json1->SizeOfArray(L"ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions");
                while (i1 < count_i1) {
                    json1->put_I(i1);
                    strVal = json1->stringOf(L"ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]");
                    i1 = i1 + 1;
                }

                delete json1;
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly");
            while (k < count_k) {
                jResp.put_K(k);
                v_Type = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type");
                Value_int = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value");
                k = k + 1;
            }

            k = 0;
            count_k = jResp.SizeOfArray(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline");
            while (k < count_k) {
                jResp.put_K(k);
                v_Type = jResp.stringOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type");
                Value_int = jResp.IntOf(L"ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }

    // A sample JSON response body parsed by the above code:

    // {
    //   "NextToken": "string",
    //   "ProactiveAnomalies": [
    //     {
    //       "AnomalyReportedTimeRange": {
    //         "CloseTime": number,
    //         "OpenTime": number
    //       },
    //       "AnomalyResources": [
    //         {
    //           "Name": "string",
    //           "Type": "string"
    //         }
    //       ],
    //       "AnomalyTimeRange": {
    //         "EndTime": number,
    //         "StartTime": number
    //       },
    //       "AssociatedInsightId": "string",
    //       "Id": "string",
    //       "Limit": number,
    //       "PredictionTimeRange": {
    //         "EndTime": number,
    //         "StartTime": number
    //       },
    //       "ResourceCollection": {
    //         "CloudFormation": {
    //           "StackNames": [
    //             "string"
    //           ]
    //         },
    //         "Tags": [
    //           {
    //             "AppBoundaryKey": "string",
    //             "TagValues": [
    //               "string"
    //             ]
    //           }
    //         ]
    //       },
    //       "Severity": "string",
    //       "SourceDetails": {
    //         "CloudWatchMetrics": [
    //           {
    //             "Dimensions": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ],
    //             "MetricDataSummary": {
    //               "StatusCode": "string",
    //               "TimestampMetricValuePairList": [
    //                 {
    //                   "MetricValue": number,
    //                   "Timestamp": number
    //                 }
    //               ]
    //             },
    //             "MetricName": "string",
    //             "Namespace": "string",
    //             "Period": number,
    //             "Stat": "string",
    //             "Unit": "string"
    //           }
    //         ],
    //         "PerformanceInsightsMetrics": [
    //           {
    //             "MetricDisplayName": "string",
    //             "MetricQuery": {
    //               "Filter": {
    //                 "string": "string"
    //               },
    //               "GroupBy": {
    //                 "Dimensions": [
    //                   "string"
    //                 ],
    //                 "Group": "string",
    //                 "Limit": number
    //               },
    //               "Metric": "string"
    //             },
    //             "ReferenceData": [
    //               {
    //                 "ComparisonValues": {
    //                   "ReferenceMetric": {
    //                     "MetricQuery": {
    //                       "Filter": {
    //                         "string": "string"
    //                       },
    //                       "GroupBy": {
    //                         "Dimensions": [
    //                           "string"
    //                         ],
    //                         "Group": "string",
    //                         "Limit": number
    //                       },
    //                       "Metric": "string"
    //                     }
    //                   },
    //                   "ReferenceScalar": {
    //                     "Value": number
    //                   }
    //                 },
    //                 "Name": "string"
    //               }
    //             ],
    //             "StatsAtAnomaly": [
    //               {
    //                 "Type": "string",
    //                 "Value": number
    //               }
    //             ],
    //             "StatsAtBaseline": [
    //               {
    //                 "Type": "string",
    //                 "Value": number
    //               }
    //             ],
    //             "Unit": "string"
    //           }
    //         ]
    //       },
    //       "SourceMetadata": {
    //         "Source": "string",
    //         "SourceResourceName": "string",
    //         "SourceResourceType": "string"
    //       },
    //       "Status": "string",
    //       "UpdateTime": number
    //     }
    //   ],
    //   "ReactiveAnomalies": [
    //     {
    //       "AnomalyReportedTimeRange": {
    //         "CloseTime": number,
    //         "OpenTime": number
    //       },
    //       "AnomalyResources": [
    //         {
    //           "Name": "string",
    //           "Type": "string"
    //         }
    //       ],
    //       "AnomalyTimeRange": {
    //         "EndTime": number,
    //         "StartTime": number
    //       },
    //       "AssociatedInsightId": "string",
    //       "CausalAnomalyId": "string",
    //       "Description": "string",
    //       "Id": "string",
    //       "Name": "string",
    //       "ResourceCollection": {
    //         "CloudFormation": {
    //           "StackNames": [
    //             "string"
    //           ]
    //         },
    //         "Tags": [
    //           {
    //             "AppBoundaryKey": "string",
    //             "TagValues": [
    //               "string"
    //             ]
    //           }
    //         ]
    //       },
    //       "Severity": "string",
    //       "SourceDetails": {
    //         "CloudWatchMetrics": [
    //           {
    //             "Dimensions": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ],
    //             "MetricDataSummary": {
    //               "StatusCode": "string",
    //               "TimestampMetricValuePairList": [
    //                 {
    //                   "MetricValue": number,
    //                   "Timestamp": number
    //                 }
    //               ]
    //             },
    //             "MetricName": "string",
    //             "Namespace": "string",
    //             "Period": number,
    //             "Stat": "string",
    //             "Unit": "string"
    //           }
    //         ],
    //         "PerformanceInsightsMetrics": [
    //           {
    //             "MetricDisplayName": "string",
    //             "MetricQuery": {
    //               "Filter": {
    //                 "string": "string"
    //               },
    //               "GroupBy": {
    //                 "Dimensions": [
    //                   "string"
    //                 ],
    //                 "Group": "string",
    //                 "Limit": number
    //               },
    //               "Metric": "string"
    //             },
    //             "ReferenceData": [
    //               {
    //                 "ComparisonValues": {
    //                   "ReferenceMetric": {
    //                     "MetricQuery": {
    //                       "Filter": {
    //                         "string": "string"
    //                       },
    //                       "GroupBy": {
    //                         "Dimensions": [
    //                           "string"
    //                         ],
    //                         "Group": "string",
    //                         "Limit": number
    //                       },
    //                       "Metric": "string"
    //                     }
    //                   },
    //                   "ReferenceScalar": {
    //                     "Value": number
    //                   }
    //                 },
    //                 "Name": "string"
    //               }
    //             ],
    //             "StatsAtAnomaly": [
    //               {
    //                 "Type": "string",
    //                 "Value": number
    //               }
    //             ],
    //             "StatsAtBaseline": [
    //               {
    //                 "Type": "string",
    //                 "Value": number
    //               }
    //             ],
    //             "Unit": "string"
    //           }
    //         ]
    //       },
    //       "Status": "string",
    //       "Type": "string"
    //     }
    //   ]
    // }
    }