Im a receiving a string of an array containing objects via http request. I parse it with eval().
So I am clearly expecting an array obj after parsing. How do i secure this eval() procedure, besides of if (Array.isArray(parsedObj)) ...
Is there even a better way than eval()?
This is part of the string (note that its not a JSON):
[
["2018-06-06", "2018-06-07", "2018-06-08", "2018-06-09", "2018-06-10", "2018-06-11", "2018-06-12", "2018-06-13", "2018-06-14", "2018-06-15", "2018-06-16"],
{
"2018-06-10": {
checkFirstOrLastOfMonth: 0,
day: "10",
dayOfWeek: "SONNTAG",
formatedDate: "10 Jun 2018",
monthNo: "06",
shortMonthName: "Jun",
weekOfYear: 24,
year: "2018"
},
"2018-06-11": {
checkFirstOrLastOfMonth: 0,
day: "11",
dayOfWeek: "MONTAG",
formatedDate: "11 Jun 2018",
monthNo: "06",
shortMonthName: "Jun",
weekOfYear: 24,
year: "2018"
},
"2018-06-09": {
checkFirstOrLastOfMonth: 0,
day: "09",
dayOfWeek: "SAMSTAG",
formatedDate: "09 Jun 2018",
monthNo: "06",
shortMonthName: "Jun",
weekOfYear: 23,
year: "2018"
},
...
eval. Write your own parser then.