File: json-map-format.rst

package info (click to toggle)
tiled-qt 1.11.90-1
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 40,304 kB
  • sloc: cpp: 125,078; java: 4,174; python: 1,634; xml: 1,524; sh: 427; makefile: 67; ruby: 15
file content (871 lines) | stat: -rw-r--r-- 29,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
JSON Map Format
===============

Tiled can export maps as JSON files. To do so, simply select "File >
Export As" and select the JSON file type. You can export json from the
command line with the ``--export-map`` option.

The fields found in the JSON format differ slightly from those in the
:doc:`tmx-map-format`, but the meanings should remain the same.

The following fields can be found in a Tiled JSON file:

.. _json-map:

Map
---

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    backgroundcolor,  string,           "Hex-formatted color (#RRGGBB or #AARRGGBB) (optional)"
    class,            string,           "The class of the map (since 1.9, optional)"
    compressionlevel, int,              "The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default)"
    height,           int,              "Number of tile rows"
    hexsidelength,    int,              "Length of the side of a hex tile in pixels (hexagonal maps only)"
    infinite,         bool,             "Whether the map has infinite dimensions"
    layers,           array,            "Array of :ref:`Layers <json-layer>`"
    nextlayerid,      int,              "Auto-increments for each layer"
    nextobjectid,     int,              "Auto-increments for each placed object"
    orientation,      string,           "``orthogonal``, ``isometric``, ``staggered`` or ``hexagonal``"
    parallaxoriginx,  double,           "X coordinate of the parallax origin in pixels (since 1.8, default: 0)"
    parallaxoriginy,  double,           "Y coordinate of the parallax origin in pixels (since 1.8, default: 0)"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    renderorder,      string,           "``right-down`` (the default), ``right-up``, ``left-down`` or ``left-up`` (currently only supported for orthogonal maps)"
    staggeraxis,      string,           "``x`` or ``y`` (staggered / hexagonal maps only)"
    staggerindex,     string,           "``odd`` or ``even`` (staggered / hexagonal maps only)"
    tiledversion,     string,           "The Tiled version used to save the file"
    tileheight,       int,              "Map grid height"
    tilesets,         array,            "Array of :ref:`Tilesets <json-tileset>`"
    tilewidth,        int,              "Map grid width"
    type,             string,           "``map`` (since 1.0)"
    version,          string,           "The JSON format version (previously a number, saved as string since 1.6)"
    width,            int,              "Number of tile columns"

Map Example
~~~~~~~~~~~

.. code:: json

    {
      "backgroundcolor":"#656667",
      "height":4,
      "layers":[ ],
      "nextobjectid":1,
      "orientation":"orthogonal",
      "properties":[
        {
          "name":"mapProperty1",
          "type":"string",
          "value":"one"
        },
        {
          "name":"mapProperty2",
          "type":"string",
          "value":"two"
        }],
      "renderorder":"right-down",
      "tileheight":32,
      "tilesets":[ ],
      "tilewidth":32,
      "version":1,
      "tiledversion":"1.0.3",
      "width":4
    }

.. _json-layer:

Layer
-----

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    chunks,           array,            "Array of :ref:`chunks <json-chunk>` (optional). ``tilelayer`` only."
    class,            string,           "The class of the layer (since 1.9, optional)"
    compression,      string,           "``zlib``, ``gzip``, ``zstd`` (since 1.3) or empty (default). ``tilelayer`` only."
    data,             array or string,  "Array of ``unsigned int`` (GIDs) or base64-encoded data. ``tilelayer`` only."
    draworder,        string,           "``topdown`` (default) or ``index``. ``objectgroup`` only."
    encoding,         string,           "``csv`` (default) or ``base64``. ``tilelayer`` only."
    height,           int,              "Row count. Same as map height for fixed-size maps. ``tilelayer`` only."
    id,               int,              "Incremental ID - unique across all layers"
    image,            string,           "Image used by this layer. ``imagelayer`` only."
    imageheight,      int,              "Height of the image used by this layer. ``imagelayer`` only. (since 1.11.1)"
    imagewidth,       int,              "Width of the image used by this layer. ``imagelayer`` only. (since 1.11.1)"
    layers,           array,            "Array of :ref:`layers <json-layer>`. ``group`` only."
    locked,           bool,             "Whether layer is locked in the editor (default: false). (since 1.8.2)"
    name,             string,           "Name assigned to this layer"
    objects,          array,            "Array of :ref:`objects <json-object>`. ``objectgroup`` only."
    offsetx,          double,           "Horizontal layer offset in pixels (default: 0)"
    offsety,          double,           "Vertical layer offset in pixels (default: 0)"
    opacity,          double,           "Value between 0 and 1"
    parallaxx,        double,           "Horizontal :ref:`parallax factor <parallax-factor>` for this layer (default: 1). (since 1.5)"
    parallaxy,        double,           "Vertical :ref:`parallax factor <parallax-factor>` for this layer (default: 1). (since 1.5)"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    repeatx,          bool,             "Whether the image drawn by this layer is repeated along the X axis. ``imagelayer`` only. (since 1.8)"
    repeaty,          bool,             "Whether the image drawn by this layer is repeated along the Y axis. ``imagelayer`` only. (since 1.8)"
    startx,           int,              "X coordinate where layer content starts (for infinite maps)"
    starty,           int,              "Y coordinate where layer content starts (for infinite maps)"
    tintcolor,        string,           "Hex-formatted :ref:`tint color <tint-color>` (#RRGGBB or #AARRGGBB) that is multiplied with any graphics drawn by this layer or any child layers (optional)."
    transparentcolor, string,           "Hex-formatted color (#RRGGBB) (optional). ``imagelayer`` only."
    type,             string,           "``tilelayer``, ``objectgroup``, ``imagelayer`` or ``group``"
    visible,          bool,             "Whether layer is shown or hidden in editor"
    width,            int,              "Column count. Same as map width for fixed-size maps. ``tilelayer`` only."
    x,                int,              "Horizontal layer offset in tiles. Always 0."
    y,                int,              "Vertical layer offset in tiles. Always 0."

Tile Layer Example
~~~~~~~~~~~~~~~~~~

The data of a tile layer can be stored as a native JSON array or as
base64-encoded and optionally compressed binary data, the same as done in the
:ref:`TMX format <tmx-data>`. The tiles are referenced using
:doc:`global-tile-ids`.

.. code:: json

    {
      "data":[1, 2, 1, 2, 3, 1, 3, 1, 2, 2, 3, 3, 4, 4, 4, 1],
      "height":4,
      "name":"ground",
      "opacity":1,
      "properties":[
        {
          "name":"tileLayerProp",
          "type":"int",
          "value":1
        }],
      "type":"tilelayer",
      "visible":true,
      "width":4,
      "x":0,
      "y":0
    }

Object Layer Example
~~~~~~~~~~~~~~~~~~~~

.. code:: json

    {
      "draworder":"topdown",
      "height":0,
      "name":"people",
      "objects":[ ],
      "opacity":1,
      "properties":[
        {
          "name":"layerProp1",
          "type":"string",
          "value":"someStringValue"
        }],
      "type":"objectgroup",
      "visible":true,
      "width":0,
      "x":0,
      "y":0
    }

.. _json-chunk:

Chunk
-----

Chunks are used to store the tile layer data for
:doc:`infinite maps </manual/using-infinite-maps>`.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    data,             array or string,  "Array of ``unsigned int`` (GIDs) or base64-encoded data"
    height,           int,              "Height in tiles"
    width,            int,              "Width in tiles"
    x,                int,              "X coordinate in tiles"
    y,                int,              "Y coordinate in tiles"

Chunk Example
~~~~~~~~~~~~~

.. code:: json

    {
      "data":[1, 2, 1, 2, 3, 1, 3, 1, 2, 2, 3, 3, 4, 4, 4, 1, ],
      "height":16,
      "width":16,
      "x":0,
      "y":-16,
    }

.. _json-object:

Object
------

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    ellipse,          bool,             "Used to mark an object as an ellipse"
    gid,              int,              "Global tile ID, only if object represents a tile"
    height,           double,           "Height in pixels."
    id,               int,              "Incremental ID, unique across all objects"
    name,             string,           "String assigned to name field in editor"
    point,            bool,             "Used to mark an object as a point"
    polygon,          array,            "Array of :ref:`Points <json-point>`, in case the object is a polygon"
    polyline,         array,            "Array of :ref:`Points <json-point>`, in case the object is a polyline"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    rotation,         double,           "Angle in degrees clockwise"
    template,         string,           "Reference to a template file, in case object is a :doc:`template instance </manual/using-templates>`"
    text,             :ref:`json-object-text`, "Only used for text objects"
    type,             string,           "The class of the object (was saved as ``class`` in 1.9, optional)"
    visible,          bool,             "Whether object is shown in editor."
    width,            double,           "Width in pixels."
    x,                double,           "X coordinate in pixels"
    y,                double,           "Y coordinate in pixels"

Object Example
~~~~~~~~~~~~~~

.. code:: json

    {
      "gid":5,
      "height":0,
      "id":1,
      "name":"villager",
      "properties":[
        {
          "name":"hp",
          "type":"int",
          "value":12
        }],
      "rotation":0,
      "type":"npc",
      "visible":true,
      "width":0,
      "x":32,
      "y":32
    }

Ellipse Example
~~~~~~~~~~~~~~~

.. code:: json

    {
      "ellipse":true,
      "height":152,
      "id":13,
      "name":"",
      "rotation":0,
      "type":"",
      "visible":true,
      "width":248,
      "x":560,
      "y":808
    }

Rectangle Example
~~~~~~~~~~~~~~~~~

.. code:: json

    {
      "height":184,
      "id":14,
      "name":"",
      "rotation":0,
      "type":"",
      "visible":true,
      "width":368,
      "x":576,
      "y":584
    }

Point Example
~~~~~~~~~~~~~

.. code:: json

    {
      "height":0,
      "id":20,
      "name":"",
      "point":true,
      "rotation":0,
      "type":"",
      "visible":true,
      "width":0,
      "x":220,
      "y":350
    }

Polygon Example
~~~~~~~~~~~~~~~

.. code:: json

    {
      "height":0,
      "id":15,
      "name":"",
      "polygon":[
      {
        "x":0,
        "y":0
      },
      {
        "x":152,
        "y":88
      },
      {
        "x":136,
        "y":-128
      },
      {
        "x":80,
        "y":-280
      },
      {
        "x":16,
        "y":-288
      }],
      "rotation":0,
      "type":"",
      "visible":true,
      "width":0,
      "x":-176,
      "y":432
    }

Polyline Example
~~~~~~~~~~~~~~~~

.. code:: json

    {
      "height":0,
      "id":16,
      "name":"",
      "polyline":[
      {
        "x":0,
        "y":0
      },
      {
        "x":248,
        "y":-32
      },
      {
        "x":376,
        "y":72
      },
      {
        "x":544,
        "y":288
      },
      {
        "x":656,
        "y":120
      },
      {
        "x":512,
        "y":0
      }],
      "rotation":0,
      "type":"",
      "visible":true,
      "width":0,
      "x":240,
      "y":88
    }

Text Example
~~~~~~~~~~~~

.. code:: json

    {
      "height":19,
      "id":15,
      "name":"",
      "text":
      {
        "text":"Hello World",
        "wrap":true
      },
      "rotation":0,
      "type":"",
      "visible":true,
      "width":248,
      "x":48,
      "y":136
    }

.. _json-object-text:

Text
----

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    bold,             bool,             "Whether to use a bold font (default: ``false``)"
    color,            string,           "Hex-formatted color (#RRGGBB or #AARRGGBB) (default: ``#000000``)"
    fontfamily,       string,           "Font family (default: ``sans-serif``)"
    halign,           string,           "Horizontal alignment (``center``, ``right``, ``justify`` or ``left`` (default))"
    italic,           bool,             "Whether to use an italic font (default: ``false``)"
    kerning,          bool,             "Whether to use kerning when placing characters (default: ``true``)"
    pixelsize,        int,              "Pixel size of font (default: 16)"
    strikeout,        bool,             "Whether to strike out the text (default: ``false``)"
    text,             string,           "Text"
    underline,        bool,             "Whether to underline the text (default: ``false``)"
    valign,           string,           "Vertical alignment (``center``, ``bottom`` or ``top`` (default))"
    wrap,             bool,             "Whether the text is wrapped within the object bounds (default: ``false``)"


.. _json-tileset:

Tileset
-------

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    backgroundcolor,  string,           "Hex-formatted color (#RRGGBB or #AARRGGBB) (optional)"
    class,            string,           "The class of the tileset (since 1.9, optional)"
    columns,          int,              "The number of tile columns in the tileset"
    fillmode,         string,           "The fill mode to use when rendering tiles from this tileset (``stretch`` (default) or ``preserve-aspect-fit``) (since 1.9)"
    firstgid,         int,              "GID corresponding to the first tile in the set"
    grid,             :ref:`json-tileset-grid`, "(optional)"
    image,            string,           "Image used for tiles in this set"
    imageheight,      int,              "Height of source image in pixels"
    imagewidth,       int,              "Width of source image in pixels"
    margin,           int,              "Buffer between image edge and first tile (pixels)"
    name,             string,           "Name given to this tileset"
    objectalignment,  string,           "Alignment to use for tile objects (``unspecified`` (default), ``topleft``, ``top``, ``topright``, ``left``, ``center``, ``right``, ``bottomleft``, ``bottom`` or ``bottomright``) (since 1.4)"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    source,           string,           "The external file that contains this tilesets data"
    spacing,          int,              "Spacing between adjacent tiles in image (pixels)"
    terrains,         array,            "Array of :ref:`Terrains <json-terrain>` (optional)"
    tilecount,        int,              "The number of tiles in this tileset"
    tiledversion,     string,           "The Tiled version used to save the file"
    tileheight,       int,              "Maximum height of tiles in this set"
    tileoffset,       :ref:`json-tileset-tileoffset`, "(optional)"
    tilerendersize,   string,           "The size to use when rendering tiles from this tileset on a tile layer (``tile`` (default) or ``grid``) (since 1.9)"
    tiles,            array,            "Array of :ref:`Tiles <json-tile>` (optional)"
    tilewidth,        int,              "Maximum width of tiles in this set"
    transformations,  :ref:`json-tileset-transformations`, "Allowed transformations (optional)"
    transparentcolor, string,           "Hex-formatted color (#RRGGBB) (optional)"
    type,             string,           "``tileset`` (for tileset files, since 1.0)"
    version,          string,           "The JSON format version (previously a number, saved as string since 1.6)"
    wangsets,         array,            "Array of :ref:`Wang sets <json-wangset>` (since 1.1.5)"

Each tileset has a ``firstgid`` (first global ID) property which
tells you the global ID of its first tile (the one with local 
tile ID 0). This allows you to map the global IDs back to the 
right tileset, and then calculate the local tile ID by 
subtracting the ``firstgid`` from the global tile ID. The first 
tileset always has a ``firstgid`` value of 1.

.. _json-tileset-grid:

Grid
~~~~

Specifies common grid settings used for tiles in a tileset. See
:ref:`tmx-grid` in the TMX Map Format.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    height,           int,              "Cell height of tile grid"
    orientation,      string,           "``orthogonal`` (default) or ``isometric``"
    width,            int,              "Cell width of tile grid"

.. _json-tileset-tileoffset:

Tile Offset
~~~~~~~~~~~

See :ref:`tmx-tileoffset` in the TMX Map Format.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    x,                int,              "Horizontal offset in pixels"
    y,                int,              "Vertical offset in pixels (positive is down)"

.. _json-tileset-transformations:

Transformations
~~~~~~~~~~~~~~~

See :ref:`tmx-tileset-transformations` in the TMX Map Format.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    hflip,            bool,             "Tiles can be flipped horizontally"
    vflip,            bool,             "Tiles can be flipped vertically"
    rotate,           bool,             "Tiles can be rotated in 90-degree increments"
    preferuntransformed, bool,          "Whether untransformed tiles remain preferred, otherwise transformed tiles are used to produce more variations"

Tileset Example
~~~~~~~~~~~~~~~

.. code:: json

            {
             "columns":19,
             "firstgid":1,
             "image":"..\/image\/fishbaddie_parts.png",
             "imageheight":480,
             "imagewidth":640,
             "margin":3,
             "name":"",
             "properties":[
               {
                 "name":"myProperty1",
                 "type":"string",
                 "value":"myProperty1_value"
               }],
             "spacing":1,
             "tilecount":266,
             "tileheight":32,
             "tilewidth":32
            }

.. _json-tile:

Tile (Definition)
~~~~~~~~~~~~~~~~~

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    animation,        array,              "Array of :ref:`Frames <json-frame>`"
    id,               int,                "Local ID of the tile"
    image,            string,             "Image representing this tile (optional, used for image collection tilesets)"
    imageheight,      int,                "Height of the tile image in pixels"
    imagewidth,       int,                "Width of the tile image in pixels"
    x,                int,                "The X position of the sub-rectangle representing this tile (default: 0)"
    y,                int,                "The Y position of the sub-rectangle representing this tile (default: 0)"
    width,            int,                "The width of the sub-rectangle representing this tile (defaults to the image width)"
    height,           int,                "The height of the sub-rectangle representing this tile (defaults to the image height)"
    objectgroup,      :ref:`json-layer`,  "Layer with type ``objectgroup``, when collision shapes are specified (optional)"
    probability,      double,             "Percentage chance this tile is chosen when competing with others in the editor (optional)"
    properties,       array,              "Array of :ref:`Properties <json-property>`"
    terrain,          array,              "Index of terrain for each corner of tile (optional, replaced by :ref:`Wang sets <json-wangset>` since 1.5)"
    type,             string,             "The class of the tile (was saved as ``class`` in 1.9, optional)"

A tileset that associates information with each tile, like its image
path, may include a ``tiles`` array property. Each tile
has an ``id`` property, which specifies the local ID within the tileset.

For the terrain information, each value is a length-4 array where each
element is the index of a :ref:`terrain <json-terrain>` on one corner
of the tile. The order of indices is: top-left, top-right, bottom-left,
bottom-right.

Example:

.. code:: json

    {
      "id":11,
      "properties":[
        {
          "name":"myProperty2",
          "type":"string",
          "value":"myProperty2_value"
        }],
      "terrain":[0, 1, 0, 1]
    }

.. _json-frame:

Frame
~~~~~

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    duration,         int,              "Frame duration in milliseconds"
    tileid,           int,              "Local tile ID representing this frame"

.. _json-terrain:

Terrain
~~~~~~~

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    name,             string,           "Name of terrain"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    tile,             int,              "Local ID of tile representing terrain"

Example:

.. code:: json

    {
      "name":"ground",
      "tile":0
    }

.. _json-wangset:

Wang Set
~~~~~~~~

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    class,            string,           "The class of the Wang set (since 1.9, optional)"
    colors,           array,            "Array of :ref:`Wang colors <json-wangcolor>` (since 1.5)"
    name,             string,           "Name of the Wang set"
    properties,       array,            "Array of :ref:`Properties <json-property>`"
    tile,             int,              "Local ID of tile representing the Wang set"
    type,             string,           "``corner``, ``edge`` or ``mixed`` (since 1.5)"
    wangtiles,        array,            "Array of :ref:`Wang tiles <json-wangtile>`"

.. _json-wangcolor:

Wang Color
^^^^^^^^^^

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    class,            string,           "The class of the Wang color (since 1.9, optional)"
    color,            string,           "Hex-formatted color (#RRGGBB or #AARRGGBB)"
    name,             string,           "Name of the Wang color"
    probability,      double,           "Probability used when randomizing"
    properties,       array,            "Array of :ref:`Properties <json-property>` (since 1.5)"
    tile,             int,              "Local ID of tile representing the Wang color"

Example:

.. code:: json

    {
      "color": "#d31313",
      "name": "Rails",
      "probability": 1,
      "tile": 18
    }

.. _json-wangtile:

Wang Tile
^^^^^^^^^

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    tileid,           int,              "Local ID of tile"
    wangid,           array,            "Array of Wang color indexes (``uchar[8]``)"

Example:

.. code:: json

    {
      "tileid": 0,
      "wangid": [2, 0, 1, 0, 1, 0, 2, 0]
    }

.. _json-objecttemplate:

Object Template
---------------

An object template is written to its own file and referenced by any
instances of that template.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    type,             string,              "``template``"
    tileset,          :ref:`json-tileset`, "External tileset used by the template (optional)"
    object,           :ref:`json-object`,  "The object instantiated by this template"

.. _json-property:

Property
--------

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    name,             string,           "Name of the property"
    type,             string,           "Type of the property (``string`` (default), ``int``, ``float``, ``bool``, ``color``, ``file``, ``object`` or ``class`` (since 0.16, with ``color`` and ``file`` added in 0.17, ``object`` added in 1.4 and ``class`` added in 1.8))"
    propertytype,     string,           "Name of the :ref:`custom property type <custom-property-types>`, when applicable (since 1.8)"
    value,            value,            "Value of the property"

.. _json-point:

Point
-----

A point on a polygon or a polyline, relative to the position of the object.

.. csv-table::
    :header: Field, Type, Description
    :widths: 1, 1, 4

    x,                double,           "X coordinate in pixels"
    y,                double,           "Y coordinate in pixels"

Changelog
---------

Tiled 1.11.1
~~~~~~~~~~~~

* Added ``imageheight`` and ``imagewidth`` properties to image layers.

Tiled 1.10
~~~~~~~~~~

* Renamed the ``class`` property on :ref:`json-tile` and :ref:`json-object`
  back to ``type``, to keep compatibility with Tiled 1.8 and earlier. The
  property remains ``class`` in other places since it could not be renamed
  to ``type`` everywhere.

Tiled 1.9
~~~~~~~~~

* Renamed the ``type`` property on :ref:`json-tile` and :ref:`json-object` to
  ``class``.

* Added ``class`` property to :ref:`json-map`, :ref:`json-tileset`,
  :ref:`json-layer`, :ref:`json-wangset` and :ref:`json-wangcolor`.

* Added ``x``, ``y``, ``width`` and ``height`` properties to :ref:`json-tile`,
  which store the sub-rectangle of a tile's image used to represent this tile.
  By default the entire image is used.

* Added ``tilerendersize`` and ``fillmode`` properties to :ref:`json-tileset`,
  which affect the way tiles are rendered.

Tiled 1.8
~~~~~~~~~

* Added support for user-defined custom property types. A reference to the
  type is saved as the new ``propertytype`` property of :ref:`json-property`.

* The :ref:`json-property` element can now have an arbitrary JSON object as its
  ``value``, in case the property value is a class. In this case the ``type``
  property is set to the new value ``class``.

* Added ``parallaxoriginx`` and ``parallaxoriginy`` properties to
  :ref:`json-map`.

* Added ``repeatx`` and ``repeaty`` properties to :ref:`json-layer` (applies
  only to image layers at the moment).

Tiled 1.7
~~~~~~~~~

* The :ref:`json-tile` objects in a tileset are no longer always saved with
  increasing IDs. They are now saved in the display order, which can be changed
  in Tiled.

Tiled 1.6
~~~~~~~~~

* The ``version`` property is now written as a string ("1.6") instead of a
  number (1.5).

Tiled 1.5
~~~~~~~~~

* Unified ``cornercolors`` and ``edgecolors`` properties of :ref:`json-wangset`
  as the new ``colors`` property and added a ``type`` field.

* :ref:`json-wangcolor` can now store ``properties``.

* Added ``transformations`` property to :ref:`json-tileset` (see
  :ref:`json-tileset-transformations`).

* Removed ``dflip``, ``hflip`` and ``vflip`` properties from
  :ref:`json-wangtile` (no longer supported).

* Added ``parallaxx`` and ``parallaxy`` properties to the :ref:`json-layer`
  object.

Tiled 1.4
~~~~~~~~~

* Added ``objectalignment`` to the :ref:`json-tileset` object.

* Added ``tintcolor`` to the :ref:`json-layer` object.

* Added ``object`` as possible type of :ref:`json-property`.

Tiled 1.3
~~~~~~~~~

* Added an ``editorsettings`` property to top-level :ref:`json-map` and
  :ref:`json-tileset` objects, which is used to store editor specific settings
  that are generally not relevant when loading a map or tileset.

* Added support for Zstandard compression for tile layer data
  (``"compression": "zstd"`` on :ref:`tile layer objects <json-layer>`).

* Added the ``compressionlevel`` property to the :ref:`json-map` object,
  which stores the compression level to use for compressed tile layer data.

Tiled 1.2
~~~~~~~~~

* Added ``nextlayerid`` to the :ref:`json-map` object.

* Added ``id`` to the :ref:`json-layer` object.

* The tiles in a :ref:`json-tileset` are now stored as an array instead
  of an object. Previously the tile IDs were stored as string keys of
  the "tiles" object, now they are stored as ``id`` property of each
  :ref:`Tile <json-tile>` object.

* Custom tile properties are now stored within each
  :ref:`Tile <json-tile>` instead of being included as
  ``tileproperties`` in the :ref:`json-tileset` object.

* Custom properties are now stored in an array instead of an object
  where the property names were the keys. Each property is now an object
  that stores the name, type and value of the property. The separate
  ``propertytypes`` and ``tilepropertytypes`` properties have been
  removed.

Tiled 1.1
~~~~~~~~~

* Added a :ref:`chunked data format <json-chunk>`, currently used for
  :doc:`infinite maps </manual/using-infinite-maps>`.

* :doc:`Templates </manual/using-templates>` were added. Templates can
  be stored as JSON files with an :ref:`json-objecttemplate` object.

* :ref:`Tilesets <json-tileset>` can now contain
  :doc:`Terrain Sets </manual/terrain>`. They are saved in the
  new :ref:`json-wangset` object (since Tiled 1.1.5).