我有一个像这样的字符串
{
recid: 1,
QualHeadID: "1",
Nomor: "1",
Qualification: "Qualification",
DetailQualification: "Detail Qualification",
Unit: "Percentage",
Target: "90.00 %",
Actual: "90.00 %",
Percentage: "100.00 %",
CategoryWeight: "60.00 %",
KpiScore: "60.00 %",
Category: "Revenue",
w2ui: {
children: [{
recid: 1007,
QualHeadID: "1",
Nomor: "1",
DetailQualification: "Description"
}]
}
}, {
recid: 2,
QualHeadID: "1",
Nomor: "2",
Qualification: "Qualification 2",
DetailQualification: "Detail Qualification 2",
Unit: "Percentage",
Target: "80.00 %",
Actual: "89.00 %",
Percentage: "111.25 %",
CategoryWeight: "10.00 %",
KpiScore: "11.13 %",
Category: "Quality",
w2ui: {
children: [{
recid: 1008,
QualHeadID: "1",
Nomor: "2",
DetailQualification: "Description 2"
}]
}
}, {
recid: 3,
QualHeadID: "1",
Nomor: "3",
Qualification: "Qualification 3",
DetailQualification: "Detail Qualification 3",
Unit: "Percentage",
Target: "85.00 %",
Actual: "99.00 %",
Percentage: "116.47 %",
CategoryWeight: "30.00 %",
KpiScore: "34.94 %",
Category: "Internal",
w2ui: {
children: []
}
}
当我尝试使用Eval()
将其转换为Object时,它可以正常工作 var jsonQual = eval("[" + $("#lblQualification1").text() + "]");
然而,我尝试转换此字符串的方式相同
{
recid: 5,
QualHeadID: "4",
Nomor: "4",
Qualification: "Competency - External",
DetailQualification: "80% of customer score top-three-boxes score",
Unit: "Percentage",
Target: "70.00 %",
Actual: "60.00 %",
Percentage: "85.71 %",
CategoryWeight: "50.00 %",
KpiScore: "42.86 %",
Category: "Quality",
w2ui: {
children: [{
recid: 1011,
QualHeadID: "4",
Nomor: "4",
DetailQualification: "80% dari total customer/company mengisi nilai 8,9 atau 10 dari range (1-10), di Nilai Total Penilaian Kepuasan Pelanggan (ex. Total customer selama periode review ada 10 cust, harus paling tidak 8 customer yang memberi nilai minimal 8) Apabila ada 7 orang memberi nilai 10, tetap ada 3 orang memberi nilai dibawah 8, dianggap tidak achieve Apabila dalam 1 company ada lebih dari 1 orang yang di survey, nilai dari company itu adalah rata2 nilai dari tiap orang yang disurvey Untuk yg Customer nya hanya 1 company, total customer berarti jumlah orang yang di survey dari company tsb"
}]
}
}, {
recid: 6,
QualHeadID: "4",
Nomor: "5",
Qualification: "Scoring Daily Activity",
DetailQualification: "90% submitted on time",
Unit: "Percentage",
Target: "80.00 %",
Actual: "60.00 %",
Percentage: "75.00 %",
CategoryWeight: "25.00 %",
KpiScore: "18.75 %",
Category: "Internal",
w2ui: {
children: [{
recid: 1012,
QualHeadID: "4",
Nomor: "5",
DetailQualification: "Each engineer must submit billable daily activity to timesheet application every Tuesday 10 AM and Friday 4 PM"
}]
}
}, {
recid: 7,
QualHeadID: "4",
Nomor: "6",
Qualification: "Self Development ",
DetailQualification: "80% attending to workshop & English Course ",
Unit: "Percentage",
Target: "80.00 %",
Actual: "90.00 %",
Percentage: "112.50 %",
CategoryWeight: "25.00 %",
KpiScore: "28.13 %",
Category: "Internal",
w2ui: {
children: [{
recid: 1013,
QualHeadID: "4",
Nomor: "6",
DetailQualification: "This qualification divided into two category. 2,5% for attending workshop and 2.5% for final score taken from English Course. If there is no workshop then 5% for English course"
}]
}
}
它不起作用
我的字符串怎么了?我从eval方法背叛的任何规则? 提前谢谢!!