Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i remove __ob__: Observer from my array list?

Tags:

vue.js

vuejs2

i have an array

data = [38589, 3, __ob__: Observer];

i want to send a put request API with the body sending this array. and got a 400 error? is it this __ob__: Observer thing is being a problem for me to sending this data? if it's the one that affect the error, can i know how to remove it from my array?

like image 288
Khairul Habib Avatar asked Dec 13 '22 09:12

Khairul Habib


1 Answers

You can convert it to JSON and then back, if you want to get the final value of the array without the observer:

const finalData = JSON.parse(JSON.stringify(data));
like image 89
Terry Avatar answered Dec 21 '22 14:12

Terry