Answer the question
In order to leave comments, you need to log in
How to transfer data from *.json file?
Found the following:
Method JSON.parse
Calling JSON.parse(str) will turn a string with data in JSON format into a JavaScript object/array/value.
For example:
var numbers = "[0, 1, 2, 3]";
numbers = JSON.parse(numbers);
alert( numbers[1] ); // 1
var user = '{ "name": "Вася", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }';
user = JSON.parse(user);
alert( user.friends[1] ); // 1
var tmp = '{"_id:", "data:", "program_id:", "total_seats:", "aveilable_seats:"}';
tmp = JSON.parse(generated.json);
alert (tmp);
Answer the question
In order to leave comments, you need to log in
webpack is used for assembly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question