1. Home
  2. Docs
  3. LEd documentation
  4. JSON
  5. Overview

Overview

Introduction

The project is stored inside a single JSON file.

The up-to-date JSON file format, directly generated from latest source code, is available below:

Example

Below is an example of a completely new & empty project file:

{
	"__header__" : {
		"fileType" : "LEd Project JSON",
		"app" : "LEd",
		"appAuthor" : "Sebastien Benard",
		"appVersion" : "1.0 Electron RC",
		"url" : "https://deepnight.net/tools/led-2d-level-editor/"
	},

	"name" : "My empty project",
	"jsonVersion" : 1,
	"defaultPivotX" : 0.0,
	"defaultPivotY" : 0.0,
	"defaultGridSize" : 16,
	"bgColor" : "#7F8093",
	"nextUid" : 1,

	"defs" : { 
		"layers" : [], 
		"entities" : [], 
		"tilesets" : [], 
		"enums" : [], 
		"externalEnums" : [] 
	},

	"levels" : [
		{ 
			"identifier" : "Level", 
			"uid" : 0, 
			"pxWid" : 256, 
			"pxHei" : 256, 
			"layerInstances" : [] 
		}
	]
}

Format overview

The file is mainly divided between 2 major blocks: definitions (defs) and level data (levels).

Definitions contain all the details and settings of each component in the project:

  • layers,
  • entities and their fields,
  • tilesets,
  • enums.

Level data contain the actual instances of each levels and their layers content, entities instances etc.

Each definition has a uid field which stands for Uniquer Identifier.

Each instance of whatever also has a defUid field which simply refers to the corresponding definition with the same uid.

Making your gamedev life easier

If all you want in your game is to access the JSON data (layers content, entities etc.), going back & forth between Definitions & Instances could be a little bit cumbersome to say the least.

To make the JSON parsing much easier, all instances have some redundant fields prefixed with a double underscores (like __value). For example, here is the JSON of an Enemy entity in a level:

"entityInstances" : [
	{
		"__identifier" : "Mob",
		"__cx" : 3,
		"__cy" : 5,
		"defUid" : 2,
		"x" : 56,
		"y" : 96,
		"fieldInstances" : []
	},
	{
		...
	},
]

Here, if you want to get the actual entity name of this Instance (ie. “Mob“), you need to use the defUid value to retrieve the Entity Definition containing the info.

Luckily, you have a __identifier value which is a redundant copy of this exact info, making it easier for you to read it.

Same goes for the grid based coordinates (__cx and __cy) which normally depend on the Layer definition which contains the grid size making an overly complicated task for a simple info.

Long story short, fields prefixed with double underscores are there to make your parsing life easier.