Figuring out Map JSON Files

Hey there! So I've recently been looking at how the JSON that make RPG Maker MV tick work, and I'm pretty much stumped at the data field of maps. What I understand so far is that empty space is 0, all of the layers are located on the same line, the data field will almost always have trailing 0s for empty space instead of resizing the array to the map size, and if one layer is empty the next layer's data will take up it's space. What want to figure out first is how the tiles are selected by ints, but so far the only lead that I have is that tileset B starts at 1. Any help is greatly appreciated!
Found more information from Tsukihime.
 

Basically, you have numTiles =  width * height


There are 6 layers, each layer with numTiles values


The array is width * height * 6


First 4 layers represent tile ID's, layer 5 is shadows, layer 6 is region.


The tile ID's are internal tile ID's that the tilemap uses to determine which bitmap to draw, and how to draw it (in the case of auto-tiles)


The format for the tile ID's is similar to what you had in VX/Ace, where 0 to 1024 are for pages B-E, and everything beyond that is for autotiles.

Original thread: https://forums.rpgmakerweb.com/threads/figuring-out-map-json-files.59070/