First of all I think this [Medical: 39, Camera: 2, Surgical: 1]
should not be an array but an object, so the syntax should be like this: {Medical: 39, Camera: 2, Surgical: 1}
Or like this: [{Medical: 39}, {Camera: 2}, {Surgical: 1}]
.
Then to transform it try this:
var obj={Medical: 39, Camera: 2, Surgical: 1};
var arr=[];
$.each(obj,function(index,element){
arr.push(element);
});
console.log(arr);
//OR like this
var obj2=[{Medical: 39}, {Camera: 2}, {Surgical: 1}];
var arr2=[];
$.each(obj2,function(index,element){
$.each(element,function(index2,element2){
arr2.push(element2);
});
});
console.log(arr2);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
5
solved jQuery : Need extract the value as another array [closed]