How to get values from coming json'a?

Get data on-demand
$.get('http://work-market-api.local/api/posts', {},
 function (response) {
 dataArr = JSON.stringify(response);
});

In dev tools I see this
0:
id: 1
profession: "roustabout"
decriptions: "Description of profession"
img: "img"
index_wages: "0.72"
index_weight: "588.00"
education_id: 1
education_higher: "0.00"
education_average: "0.00"
education_common: "1.00"
industry_id: 0
created_at: null
updated_at: null
__proto__: Object
1:
id: 2
profession: "Doctor "
decriptions: "Description of profession"
img: "img"
index_wages: "1.17"
index_weight: "414.42"
education_id: 3
education_higher: "1.00"
education_average: "0.00"
education_common: "0.00"
industry_id: 0
created_at: null
updated_at: null
__proto__: Object


How can I convert data types:
["0.72","588.00","roustabout",...]
?
April 3rd 20 at 18:27
1 answer
April 3rd 20 at 18:29
Try as) I understand you need in a regular array to convert?
$.get('http://work-market-api.local/api/posts', {},
 function (response) {
 var dataObj = JSON.parse(response);
 var arr = [];
 for(var i in dataObj) { 
 arr[i] = [];
 for(var index in dataObj[index]) {
 arr[i][index] = dataObj[i][index];
}
}
console.log(arr);
});
I tried your example
parse is not suitable, because JSON believes that the object... so it gives an error
with stringify works, but creates 86052 array ))) - caden21 commented on April 3rd 20 at 18:32
@caden21, in response gets a JSON string? print console.log(response) - Brando_Trantow commented on April 3rd 20 at 18:35

Find more questions by tags JavaScript