# Tilemap with REST-API

**URL:** <https://phaser.discourse.group/t/tilemap-with-rest-api/2879>\
**Category:** Phaser 3\
**Created:** [June 23, 2019, 8:24pm UTC](https://phaser.discourse.group/t/tilemap-with-rest-api/2879 "2019-06-23T20:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/flashpixx/32/1610_2.png) [@flashpixx](https://phaser.discourse.group/u/flashpixx)\
**Post date:** [June 23, 2019, 8:24pm UTC](https://phaser.discourse.group/t/tilemap-with-rest-api/2879/1 "2019-06-23T20:24:35Z")

</div>

Hello,

I create a complex Spring Boot simulation with React and Phaser. The simulation can be configured by the user and saved within a session. I have a PNG file for the different tiles of the simulation (65x65 pixels for each tile). When the React component is mounted with the phaser engine, the Phaser.Game is initialized, the PNG file is loaded into the preload function, and the tilemap is loaded with

```
this.load.tilemapTiledJSON("map", "/environment/map");

```

If I understood it correctly, the JSON defines the complete tilemap. But I don’t understand how I’m supposed to be the structure of the JSON to be returned by this REST call.

My simulation consists of 3 layers:

1. static background of walls / solids
2. dynamic immovable elements to be set / removed by the simulation via websocket, but through which the moving figures can pass
3. dynamic moving figures which are continuously changed via a web socket

I am working with phaser for the first time, so I need some help how to realize this project in detail.

Thank you a lot for help

Phil

---

<div class="post-metadata">

**Author:** ![jorbascrumps](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jorbascrumps/32/1649_2.png) [@jorbascrumps](https://phaser.discourse.group/u/jorbascrumps)\
**Post date:** [June 24, 2019, 12:39am UTC](https://phaser.discourse.group/t/tilemap-with-rest-api/2879/2 "2019-06-24T00:39:25Z")

</div>

`tilemapTiledJSON` expects a specific file format export from [Tiled](https://www.mapeditor.org). Checkout this [file](http://labs.phaser.io/assets/tilemaps/maps/cybernoid.json) from the [Labs](http://labs.phaser.io) for an example structure.

---

<div class="post-metadata">

**Author:** ![jorbascrumps](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jorbascrumps/32/1649_2.png) [@jorbascrumps](https://phaser.discourse.group/u/jorbascrumps)\
**Post date:** [July 3, 2019, 12:20pm UTC](https://phaser.discourse.group/t/tilemap-with-rest-api/2879/3 "2019-07-03T12:20:31Z")

</div>

@flashpixx I’ve written [an article](https://dev.to/jorbascrumps/loading-server-generated-tilemaps-with-phaser-4mm7) about working with Tilemap data returned from a REST API if you’re interested.

---

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/flashpixx/32/1610_2.png) [@flashpixx](https://phaser.discourse.group/u/flashpixx)\
**Post date:** [July 9, 2019, 8:09pm UTC](https://phaser.discourse.group/t/tilemap-with-rest-api/2879/4 "2019-07-09T20:09:11Z")

</div>

@jorbascrumps sorry for my late replay, I’m very busy at the moment, but this article seems to be great for me, so I will read it and try to build my application. Thanks a lot
