like
{"name":"`111","password":"111","title":"111","tag":"111","contents":"1111"},{ "name":"222","password":"22","title":"22","tag":"22","contents":"222"},{"name":"11", "password":"11","title":"11","tag":"11","contents":"11111"}
Converted to
[{"name":"`111","password":"111","title":"111","tag":"111","contents":"1111"}, {"name":"222","password":"22","title":"22","tag":"22","contents":"222"},{"name":"11" ,"password":"11","title":"11","tag":"11","contents":"11111"}]
To add, this is the data transmitted from the backend to the frontend
I improved the code upstairs and got the effect the poster wanted
What you mean is:
Put the data in the .json file sent from the backend into the new object array on the frontend.
Ajax is required for transmission (an example is the ajax method of jquery). You can also try axios, which is more popular now.
Assumptions:
1. The file that needs to be passed in is test.json
2. The data content of test.json is
Conversion:
1. Obtain data through ajax, and the obtained content is stored in data
2. Traverse the json data and save it into a new object array, and perform it in the success function