Importing a game or its components from its JSON can be done in several ways:
Each object that can be imported can be exported to retrieve its structure in the current game, as described in the export instructions section.
If you need to add NEW levels to the game, the JSON should be a list of one or more levels, separated by commas. For the level to be added (rather than updating an existing one), it must NOT have a `number` field inside the `task` settings section. A description of the level structure can be found here.
If you need to update EXISTING levels in the game, the JSON should be a list of one or more levels, separated by commas, and the `number` field in the `task` settings section must be passed (corresponding to the level number being edited). A description of the level structure can be found here.
If present in the JSON, game settings from the `task` section will replace the existing values in the engine. If fields are omitted from the provided JSON, they will remain as they were.
For other sections (`codes`, `bonuses`, `hints`), if the section is present in the JSON, it will completely replace the existing one. If omitted, the section remains unchanged.
A level can be found by more than its number: pass the level id in the task section (an export with ids=1 hands it out) and exactly that level is updated, even when you are changing its number at the same time. If the game has no level with that id, the import fails instead of creating a new one.
To change single codes, bonuses or hints without resending the whole list, see the *_edit sections.
It is possible to upload the entire game from a JSON object. For this, the JSON must be a complete game JSON, as described on the JSON structure description page. Additionally, you must add the field "delete_all_tasks": 1 to the JSON to delete all existing levels and reload the game from scratch, for example:
{ "game": { "name": "#New Unnamed Game 2", }, "tasks": [{"task": {"number": 1, "working_name": "Title"}, "codes": [], "bonuses": [], "hints": []}], "gbonuses": [], "lines": [], "delete_all_tasks": 1, }
If present in the JSON, game settings from the `game` section will replace the existing values in the engine. If fields are omitted from the provided JSON, they will remain as they were in the game before.
For other sections (`gbonuses`, `lines`), if the section is present in the JSON, it will completely replace the existing one. If omitted, the section remains unchanged.
The codes, bonuses, hints, gbonuses and tasks sections replace a whole list. That is convenient when you build a game from scratch, but it means resending a whole level because of one changed code.
Next to each of those sections there is an “editing” one: codes_edit, bonuses_edit, hints_edit, gbonuses_edit, tasks_edit. It lists only the items you are changing:
{ "tasks_edit": [ { "task": {"id": 123, "working_name": "New title"}, /* only the title changes - the task text does not have to travel */ "codes_edit": [ {"id": 56, "delete": 1}, /* this code is removed */ {"id": 55, "code": "abc"}, /* only the code field of this one changes */ {"code": "new code"} /* and this one is appended to the list */ ] } ] }
The rules:
id, which an export with ids=1 gives you;id the item is looked up by its number (its position in the list);“delete”: 1 removes the item. Deletions are applied before everything else, so one request can drop a code and add another;number of codes, bonuses and hints is recalculated by the engine so that the numbers run without gaps (hints like %codes 2-5% refer to them).
Naming both codes and codes_edit for one list is refused: the second one would edit items the first one has just thrown away.
A level is deleted through tasks_edit:
{ "tasks_edit": [ {"task": {"id": 123}, "delete": 1}, {"task": {"id": 124, "number": 1}} /* and, for instance, move the next level into the freed number */ ] }
The level takes its codes, bonuses, hints and the teams' answers with it - which is why deleting a level is not allowed in a game that has already started. To delete every level at once, use "delete_all_tasks": 1 (see above).
Level numbers are left alone: the lines refer to them, so after a deletion you decide yourself how to renumber the rest, in the same request.
ROW_ID_NOT_FOUND - no item with this id in this level (or in this game);TASK_ID_NOT_FOUND - no level with this id in this game;DUPLICATE_ROW_KEY, DUPLICATE_TASK_ID - the same item (level) is named twice in one request;DELETE_TARGET_NOT_FOUND - nothing to delete: the item was not found or not named;LIST_AND_EDIT - one request holds both codes and codes_edit;DELETE_FORBIDDEN - deleting a level in a game that has already started.You only need to pass the game settings structure in the JSON, as described on the JSON structure page.
You only need to pass the global bonuses structure in the JSON, as described on the JSON structure page.
You only need to pass the global bonuses structure in the JSON, as described on the JSON structure page.
Modern chatbots (ChatGPT, Claude, Gemini, etc.) do an excellent job of generating and editing levels, codes, hints, and bonuses in JSON format for the qeng.org engine.
You can find the ready-to-use system prompt for chatbot configuration in the section: Using AI to create tasks.