Я использую React native 0.55.0.Для API я использую Axios, Иногда я получаю недопустимую json
Иногда я получаю недопустимую строку json с добавлением недопустимой строки, например, "type_name" в "ty" type_name ". Api на стороне сервераработает правильно. Некоторое время он работает корректно с объектом json, не понимая, что это за проблема
Файл действий
export function getNotifications(params):Action {
return (dispatch) => {
dispatch({
type: SET_NOTIFICATIONS_LIST_REQUEST
})
return getNotificationsApi(params).then(resp => {
var data = resp.data
alert(typeof data) //it's return string
console.log(data)
dispatch(getNotificationsSuccess(data))
return resp.data
}).catch(err => {
})
}
}
Данные, которые я получил
{"data":[{"id":583,"type":"itemcomment","type_id":10036,"datetime":"2018-05-15T06:48:39","status":1,"user_id":8,"type_name":"test new","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}},{"id":581,"type":"itemcomment","type_id":10036,"datetime":"2018-05-15T06:48:05","status":1,"user_id":8,"type_name":"test new","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}},{"id":578,"type":"itemcomment","type_id":10036,"datetime":"2018-05-15T06:42:50","status":1,"user_id":8,"type_name":"test new","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}},{"id":449,"type":"editoutfits","type_id":5,"datetime":"2018-05-09T10:48:15","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":430,"type":"edititem","type_id":10034,"datetime":"2018-05-08T07:59:29","status":1,"user_id":8,"type_name":"Item3","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524568505IMG_0344.PNG"},{"image":"1525761327virtual_closet_mobile.jpg"}]},{"id":427,"type":"edititem","type_id":10034,"datetime":"2018-05-08T06:35:26","status":1,"user_id":8,"type_name":"Item3","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524568505IMG_0344.PNG"},{"image":"1525761327virtual_closet_mobile.jpg"}]},{"id":424,"type":"editoutfits","type_id":5,"datetime":"2018-05-08T05:44:08","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":421,"type":"editoutfits","type_id":5,"datetime":"2018-05-08T05:38:41","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":418,"type":"editoutfits","type_id":5,"datetime":"2018-05-08T05:38:29","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":355,"type":"editoutfits","type_id":5,"datetime":"2018-05-03T05:44:22","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":353,"type":"edititem","type_id":10025,"datetime":"2018-05-02T12:03:54","status":1,"user_id":8,"type_name":"Item1","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524201903virtual_closet_mobile.jpg"},{"image":"1524201903IMG_0190.PNG"}]},{"id":351,"type":"editoutfits","type_id":5,"datetime":"2018-05-02T05:48:26","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":283,"type":"addoutfits","type_id":8,"datetime":"2018-04-24T12:26:24","status":1,"user_id":6,"type_name":"Testttttt","user":{"username":"user2","id":"6","first_name":"sonam","last_name":"dogra"},"user_meta":{"value":"1524139232IMG_0186.PNG"},"oufitimg":"1524572784newlookImage.jpg"},{"id":250,"type":"additem","type_id":10034,"datetime":"2018-04-24T11:15:05","status":1,"user_id":8,"type_name":"Item3","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524568505IMG_0344.PNG"},{"image":"1525761327virtual_closet_mobile.jpg"}]},{"id":235,"type":"editoutfits","type_id":3,"datetime":"2018-04-24T10:18:03","status":1,"user_id":8,"type_name":"Outfit1","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525261115newlookImage.jpg"},{"id":232,"type":"addoutfits","type_id":5,"datetime":"2018-04-24T10:17:49","status":1,"user_id":8,"type_name":"Test","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525758248newlookImage.jpg"},{"id":225,"type":"addoutfits","type_id":3,"datetime":"2018-04-24T10:10:26","status":1,"user_id":8,"type_name":"Outfit1","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"oufitimg":"1525261115newlookImage.jpg"},{"id":207,"type":"likeitem","type_id":10026,"datetime":"2018-04-23T12:46:53","status":1,"user_id":8,"type_name":"Item2","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}},{"id":206,"type":"itemcomment","type_id":10032,"datetime":"2018-04-23T12:35:29","status":1,"user_id":8,"type_name":"","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}},{"id":190,"type":"additem","type_id":10026,"datetime":"2018-04-20T05:31:30","status":1,"user_id":8,"ty"type_name":"Item2","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524202290IMG_0125.PNG"},{"image":"1524202290virtual_closet_mobile.jpg"},{"image":"1524202290virtual_closet_mobile.jpg"}]},{"id":187,"type":"additem","type_id":10025,"datetime":"2018-04-20T05:25:03","status":1,"user_id":8,"type_name":"Item1","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"},"itemimg":[{"image":"1524201903virtual_closet_mobile.jpg"},{"image":"1524201903IMG_0190.PNG"}]},{"id":60,"type":"acceptrequest","type_id":8,"datetime":"2018-04-19T17:23:46","status":1,"user_id":8,"type_name":"","user":{"username":"user4","id":"8","first_name":"ruhi","last_name":"vohra"},"user_meta":{"value":"1524139730IMG_0189.JPG"}}],"result":"success","image_path":"img\\/users"}
Пожалуйста, помогите, если кто-нибудь может Это проблема с памятью