1. Home
  2. Docs
  3. In-game implementation
  4. JSON overview
  5. Making your dev life easier

Making your dev 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.