angularjs $http.get alter the response of a nested json array

Viewed 35
$http.get("./getData").then((response) => {/*fetch json data from server*/  
     console.log(response);/*print the response data*/  
 } 

    //printed as   
    {  
        "jdata1": [{  
            "total1": 0,  
            "total2":1,  
            "othertotal1":{  
                "type":"json",  
                "value":"[{\"id\" : 123,\"ototal1\" : 2,\"ototal2\" : 3},{\"id\" : 456,\"ototal1\" : 4,\"ototal2\" : 5}]"  
            }  
        },{  
            "total1": 0,  
            "total2":1,  
            "othertotal1":{  
                "type":"json",  
                "value":"[{\"id\" : 123,\"ototal1\" : 2,\"ototal2\" : 3},{\"id\" : 456,\"ototal1\" : 4,\"ototal2\" : 5}]"  
            }  
        }  
        ],  
        "jdata2": [{  
            "test1": "1",  
            "test2": "A"  
        }, {  
            "test1": "2",  
            "test2": "B"  
        }]  
    }  
    
    //but actual data from server is   
    
    {  
        "jdata1": [{  
            "total1": 0,  
            "total2":1,  
            "othertotal1":[{  
                    "id" : 123,  
                    "ototal1" : 2,  
                    "ototal2" : 3  
                },{  
                    "id" : 456,  
                    "ototal1" : 4,  
                    "ototal2" : 5  
            }]  
            
        },{  
            "total1": 0,  
            "total2":1,  
            "othertotal1":[{  
                    "id" : 123,  
                    "ototal1" : 2,  
                    "ototal2" : 3  
                },{  
                    "id" : 456,  
                    "ototal1" : 4,  
                    "ototal2" : 5  
            }]  
        }  
        ],  
        "jdata2": [{  
            "test1": "1",  
            "test2": "A"  
        }, {  
            "test1": "2",  
            "test2": "B"  
        }]  
    }  

0 Answers
Related