Export all maps in a directory

Is it possible to run Tiled from command line (ideally in a headless form) and export a map (to json in my case)?

Essentially I want to add a step to my game’s build pipeline to export every TMX map in a directory to JSON (rather than having to do it manually map, by map).

Thanks!

Yeah, you can do this with the --export-map command-line parameter. It’s briefly mentioned here, but I should document the command-line properly sometime.

tiled --export-map [format] <inputfile> <outputfile>

The format is optional and will be auto-detected by the file extension, it generally only needs to be used when the file extension is ambiguous (.json generally isn’t, unless you enabled both the “json” plugin and the “json1” plugin). You can get the list of formats using:

tiled --export-formats
1 Like