Reference format files

Is there a set of XML and/or JSON maps/tilesets/templates/worlds/… that a compliant library has to load and store correctly?

A schema would be nice too.

There is not. The maps and tilesets included with Tiled in /examples/ cover many of Tiled’s features, but not all of them. It’s a good place to start though, as it includes ortho, iso, and hex maps, embedded and external tilesets, image-based and image collection tilesets, maps with one and multiple tilesets, templates, custom properties, objects (including Tile Objects). Some notable things that are missing from the examples are object references and file properties, tile animations, layer groups, image layers, the new custom property types (classes, enums), and tilesets with reordered tiles.

Not currently. As part of the recent work on AutoMapping I have been introducing some related auto-tests though, and it would be good to also set up auto-tests for loading of TMX and JSON files that cover all features, which would also make such data available for use by such libraries.

At least for the TMX format there is an XSD: tiled/map.xsd at master · mapeditor/tiled · GitHub, though it might not be entirely up-to-date.

For JSON I’ve done some initial work towards a JSON Schema, though it’s challenging to describe this format, for example since JSON Schema does not really support inheritance, which the different layer types depend on: docs: Initial version of JSON Schema for Tiled · mapeditor/tiled@a1e0567 · GitHub