Я пытаюсь создать файл json для своей игры. Предполагается загрузка позиций персонажей, игровой уровень и др. c. Но, очевидно, структура моего json кода неверна. Лично я не знаю, что не так, поскольку у меня нет большого опыта в json. Я запустил свой код в https://jsonlint.com/ и там написано
Ошибка: Ошибка разбора в строке 350: ... "NPC_groupA": {(2860, 3585): "X-400 - --------------------- ^ Ожидая 'STRING', '}', получил 'undefined'
Когда я запустил словарь "Команды" в python все загружается нормально. Код выглядит так:
{
"Level": 1,
"NPC_groups": {
"NPC_groupA": [{
"x": 2860,
"y": 3585,
"speed": 8,
"type":"NPC"
},
{
"x": 2481,
"y": 3596,
"speed": 8,
"type":"NPC"
}
],
"NPC_groupB": [{
"x": 2691,
"y": 3009,
"speed": 6,
"type":"NPC"
},
{
"x": 2600,
"y": 3009,
"speed": 6,
"type":"NPC"
},
{
"x": 2854,
"y": 3324,
"speed": 0,
"type":"NPC"
}
],
"NPC_groupC": [{
"x": 2615,
"y": 2551,
"speed": 0,
"type":"NPC"
},
{
"x": 2714,
"y": 2551,
"speed": 0,
"type":"NPC"
},
{
"x": 3002,
"y": 2773,
"speed": 8,
"type":"NPC"
},
{
"x": 2549,
"y": 1910,
"speed": 8,
"type":"NPC"
},
{
"x": 2440,
"y": 2671,
"speed": 12,
"type":"NPC"
},
{
"x": 2890,
"y": 2171,
"speed": 12,
"type":"NPC"
}
],
"NPC_groupD": [{
"x": 2842,
"y": 1672,
"speed": 10,
"type":"NPC"
},
{
"x": 2552,
"y": 916,
"speed": 10,
"type":"NPC"
},
{
"x": 3002,
"y": 2773,
"speed": 8,
"type":"NPC"
}
],
"NPC_groupE": [{
"x": 1640,
"y": 775,
"speed": 0,
"type":"NPC"
},
{
"x": 1530,
"y": 570,
"speed": 8,
"type":"NPC"
},
{
"x": 720,
"y": 740,
"speed": 12,
"type":"NPC"
},
{
"x": 1100,
"y": 590,
"speed": 0,
"type":"NPC"
},
{
"x": 1170,
"y": 590,
"speed": 0,
"type":"NPC"
},
{
"x": 610,
"y": 620,
"speed": 8,
"type":"NPC"
},
{
"x": 450,
"y": 1100,
"speed": 8,
"type":"NPC"
},
{
"x": 525,
"y": 1100,
"speed": 8,
"type":"NPC"
},
{
"x": 365,
"y": 700,
"speed": 0,
"type":"NPC"
}
],
"NPC_groupF": [{
"x": 4030,
"y": 670,
"speed": 0,
"type":"NPC"
},
{
"x": 3752,
"y": 683,
"speed": 12,
"type":"NPC"
},
{
"x": 4100,
"y": 670,
"speed": 8,
"type":"NPC"
},
{
"x": 4500,
"y": 650,
"speed": 8,
"type":"NPC"
}
],
"NPC_groupG": [{
"x": 1850,
"y": 4500,
"speed": 10,
"type":"NPC"
},
{
"x": 1100,
"y": 4715,
"speed": 10,
"type":"NPC"
},
{
"x": 1400,
"y": 4900,
"speed": 10,
"type":"NPC"
},
{
"x": 1630,
"y": 4900,
"speed": 10,
"type":"NPC"
},
{
"x": 580,
"y": 3200,
"speed": 9,
"type":"NPC"
},
{
"x": 580,
"y": 3400,
"speed": 9,
"type":"NPC"
}
],
"NPC_groupH": [{
"x": 3500,
"y": 4630,
"speed": 8,
"type":"NPC"
},
{
"x": 4200,
"y": 4480,
"speed": 0,
"type":"NPC"
},
{
"x": 4300,
"y": 4480,
"speed": 8,
"type":"NPC"
},
{
"x": 3780,
"y": 4360,
"speed": 0,
"type":"NPC"
},
{
"x": 3930,
"y": 3700,
"speed": 9,
"type":"NPC"
}
],
"NPC_groupI": [{
"x": 2080,
"y": 4450,
"speed": 8,
"type":"NPC"
},
{
"x": 2350,
"y": 4300,
"speed": 8,
"type":"NPC"
},
{
"x": 2600,
"y": 4300,
"speed": 8,
"type":"NPC"
},
{
"x": 2900,
"y": 4300,
"speed": 8,
"type":"NPC"
},
{
"x": 3150,
"y": 4550,
"speed": 8,
"type":"NPC"
},
{
"x": 2900,
"y": 4900,
"speed": 8,
"type":"NPC"
},
{
"x": 2600,
"y": 4900,
"speed": 8,
"type":"NPC"
},
{
"x": 2350,
"y": 4900,
"speed": 8,
"type":"NPC"
},
{
"x": 2080,
"y": 4700,
"speed": 8,
"type":"NPC"
}
],
"NPC_groupJ": [{
"x": 4400,
"y": 2900,
"speed": 9,
"type":"Animal"
},
{
"x": 3960,
"y": 3100,
"speed": 9,
"type":"Animal"
},
{
"x": 3960,
"y": 3300,
"speed": 9,
"type":"Animal"
},
{
"x": 3960,
"y": 3450,
"speed": 9,
"type":"Animal"
}
],
"NPC_groupK": [{
"x": 580,
"y": 1750,
"speed": 9,
"type":"Animal"
},
{
"x": 580,
"y": 2050,
"speed": 9,
"type":"Animal"
},
{
"x": 1180,
"y": 2100,
"speed": 9,
"type":"Animal"
},
{
"x": 1100,
"y": 2660,
"speed": 9,
"type":"Animal"
}
]
},
"Commands": {
"NPC_groupA": {
(2860, 3585): "X-400W2,Y410W2,X400W2,Y-410W2",
(2481, 3596): "XY400W1.5,XY-400W1.5"
},
"NPC_groupB": {
(2691, 3009): "Y310W0.2,X-10W2,X10W0,Y-310W0,X-2W2,X2W0",
(2600, 3009): "Y310W0.2,X10W2,X-10W0,Y-310W0,X2W2,X-2W0"
},
"NPC_groupC": {
(3002, 2773): "Y-400W0.5,X190W0,X-8W0.2,X-182W1.5,Y400W0",
(2890, 2171): "X-450W0,Y500W0,X450W0,Y-500W0",
(2440, 2671): "X450W0,Y-500W0,X-450W0,Y500W0",
(2549, 1910): "X-125W1,Y150W0,X-125W0,Y150W0,Y420W0,Y-420W1,Y-150W0,X125W0,Y-150W0,X125W0"
},
"NPC_groupD": {
(2842, 1672): "Y-900W4,X-300W3,Y900W0.5,X300W0.5",
(2552, 916): "Y800W4,X300W3,Y-800W0.5,X-300W0.5",
(2836, 683): "X-300W0.8,X300W0.8"
},
"NPC_groupE": {
(720, 740): "X450W0.1,Y430W0.1,X-450W0.1,Y-430W0.1",
(1530, 570): "Y280W0.5,Y-280W0.6",
(610, 620): "XY180W2,XY-180W1",
(450, 1100): "Y-480W1.4,Y480W1.4",
(525, 1100): "Y-480W1.4,Y480W1.4"
},
"NPC_groupF": {
(3752, 683): "X-300W1,Y100W0.1,X300W0.5,Y-100W0.2",
(4100, 670): "XY150W1.5,XY-150W1.5",
(4500, 650): "XY200W0.5,Y-160W1,X-120W1"
},
"NPC_groupG": {
(1850, 4500): "X-300W0.1,Y200W0.1,X300W0.1,Y-200W0.1",
(1100, 4715): "X300W0.1,Y-200W0.1,X-300W0.1,Y200W0.1",
(1630, 4900): "XY250W1,XY-250W2",
(1400, 4900): "XY250W2,XY-250W1",
(580, 3200): "XY500W0.5,XY-500W1",
(580, 3400): "XY500W1,X-500W0.8"
},
"NPC_groupH": {
(3500, 4630): "X80W1,Y-20W0.1,X80W0.1,Y-20W0.1,X80W0.1,Y-20W0.1,X80W0.1,Y-20W0.1,X-80W1,Y20W0.1,X-80W0.1,Y20W0.1,X-80W0.1,Y20W0.1,X-80W0.1,Y20W0.1",
(4300, 4480): "XY-350W1,XY350W1",
},
"NPC_groupI": {
(2080, 4700): "Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1",
(2080, 4450): "X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1",
(2350, 4300): "X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-25W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1",
(2600, 4300): "X300W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-25W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X230W0.1",
(2900, 4300): "XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1",
(3150, 4550): "X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1",
(2900, 4900): "X-550W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1",
(2600, 4900): "X-250W0.1,XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-300W0.1",
(2350, 4900): "XY-200W0.1,X-70W0.1,Y-250W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-50W0.1,X90W0.1,Y-25W0.1,X530W0.1,XY250W0.1,X-125W0.1,Y175W0.1,X-125W0.1,Y175W0.1,X-550W0.1"
},
"NPC_groupJ": {
(4400, 2900): "X-340W1,XY440W1,XY-440W1,X340W1",
(3960, 3100): "X400W1,X-400W1",
(3960, 3450): "X400W1,X-400W1"
},
"NPC_groupK": {
(580, 1750): "X440W1,X-440W1",
(580, 2050): "X440W1,X-440W1",
(1180, 2100): "X-220W1,X-220W1,X220W1,X220W1",
(580, 2220): "XY440W1,XY-440W1",
(1100, 2660): "XY-220W1,XY220W2.5"
}
}