AnsweredAssumed Answered

Loops in CA Policy Manager?

Question asked by Sathish2306 on Aug 25, 2015
Latest reply on Dec 10, 2015 by goeer03

Hi All,

 

So for Example i have json like the below,

 

{

    "id": "1",

    "values": [

        {

            "sum": "a+b",

            "diff": "a-b"

        },

        {

            "sum1": "a+b",

            "diff2": "a-b"

        }

    ],

    "valuesId": {

        "a": {

            "b": "c"

        },

        "d": "e"

    },

    "valuesfor": [

        {

            "1": {

                "2": "3"

            },

            "4": {

                "5": "6"

            }

        }

    ]

}

 

1. How can i loop through values array ? kind of (for/forEach)

2. How can i loop through valuesId Object?  kind of (Object.keys() / forEach)

3. So for example i want to change the above input to the below format, how can i achieve this?

 

{

    "id": "1",

    "values": [

        {

            "modifysum": "a+b",

            "modifydiff": "a-b"

        },

        {

            "modifysum1": "a+b",

            "modifydiff2": "A_B+A_B"

        }

    ],

    "valuesId": {

        "modifyA": {

            "soB": "SoC"

        },

        "ModifyD": "ModifyE"

    },

    "valuesfor": [

        {

            "1": {

                "2": "3"

            },

            "4": {

                "5": "6"

            }

        }

    ]

}

Outcomes