Answer the question
In order to leave comments, you need to log in
How to convert such JSON into an array in JSX (React Native)?
{"response":[{"id":"1","cat_id":"1","title":"\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u044b \u043f\u0438\u0442\u0430\u043d\u0438\u044f","get_catalog":"campony_ru","language":"1","visible":null},{"id":"2","cat_id":"2","title":"\u0421\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0438 \u0440\u0435\u043c\u043e\u043d\u0442","get_catalog":"campony_ru","language":"1","visible":null},{"id":"3","cat_id":"3","title":"\u041e\u0434\u0435\u0436\u0434\u0430 \u0438 \u043e\u0431\u0443\u0432\u044c","get_catalog":"campony_ru","language":"1","visible":null},{"id":"4","cat_id":"4","title":"\u0414\u0435\u0442\u0441\u043a\u0438\u0435 \u0438\u0433\u0440\u0443\u0448\u043a\u0438","get_catalog":"campony_ru","language":"1","visible":null}]}
Answer the question
In order to leave comments, you need to log in
JSON.stringify - used for other purposes, this method converts the data into a JSON string.
The response property is already an array. You just need to contact him.
If the data needs to be parsed (which I doubt), then the JSON.parse method should be used
const response = JSON.parse('{"response":[{"id":"1","cat_id":"1","title":"\u041f\u0440\u043e\u0434\u0443\u043a\u0442\u044b \u043f\u0438\u0442\u0430\u043d\u0438\u044f","get_catalog":"campony_ru","language":"1","visible":null},{"id":"2","cat_id":"2","title":"\u0421\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0438 \u0440\u0435\u043c\u043e\u043d\u0442","get_catalog":"campony_ru","language":"1","visible":null},{"id":"3","cat_id":"3","title":"\u041e\u0434\u0435\u0436\u0434\u0430 \u0438 \u043e\u0431\u0443\u0432\u044c","get_catalog":"campony_ru","language":"1","visible":null},{"id":"4","cat_id":"4","title":"\u0414\u0435\u0442\u0441\u043a\u0438\u0435 \u0438\u0433\u0440\u0443\u0448\u043a\u0438","get_catalog":"campony_ru","language":"1","visible":null}]}');
const responseData = response.response;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question