Can't export to JSON (SOLVED)


(aroint) #1

Hi, first thing is would do, is to thank you for this nice editor.

I have a problem related to export to JSON, and i’m not sure if i’m doing something wrong. I spent some hours researching info and seems that i’m the only one who can’t export his maps to JSON. All the others exports works fine, but when i try to export to JSON… the program exports to the previous file extension i exported. For example if exported to CSV, when i choose export to JSON… the output is a CSV file. As i’m new using your map editor (dowloaded two days ago), i’m not sure if i’m missing something… I’m using Windows 7 Pro and i tried both 32 and 64bits Tiled installers.

Thanks in advance.


(Thorbjørn Lindeijer) #2

Hmm, could it be that your problem is that you’re only changing the extension, but leaving the file type combo box on the previously used format? Selecting a format in that combo box forces Tiled to use that format regardless of the file extension you write.


(aroint) #3

No, i used the combo box to choose the file format to export. Works well when i choose any other file than JSON… if i choose this, sometimes the file extension just don’t change and still the previous extension and sometimes just turn to CSV extension… really weird. I know i can work with the other file types, but i’m really new on this and JSON feels more neat and confortable to me, so i appreciate your concern on this issue.


(Jaail Valenzuela) #4

U can solved it ? i have the same problem, please help. Im begginer too, or explain me who load map with csv or tmx extension, thanks !


(aroint) #5

Yes, i found how to solve it. I was confused because JSON export outputs a .csv extension file. But when i open that file i had seen the content was the same as an usual JSON file instead of the content of a CSV file export… so i changed the .csv extension for .json extension and it worked like a charm.

Seems this problem only happens in the first JSON export if you don’t have a .json file yet… then the export outputs a .csv file instead .json as i said. Already you have a .json file, export works fine.

So now what i do, is to create “by hand” an empty JSON file before start to mapping with Tiled.


(Jaail Valenzuela) #6

I tried creating an empty JSON file and export later but not works, i find a way to use csv file, Then I left the method that works for me using a tilemap .csv

function preload() {

game.load.tilemap('map', 'csv/catastrophi_level2.csv', null, Phaser.Tilemap.CSV);
game.load.image('tiles', 'tiles/catastrophi_tiles_16.png');

}

var map;
var layer;
var cursors;

function create() {

//  Because we're loading CSV map data we have to specify the tile size here or we can't render it
map = game.add.tilemap('map', 16, 16);

//  Now add in the tileset
map.addTilesetImage('tiles');

//  Create our layer
layer = map.createLayer(0);

//  Resize the world
layer.resizeWorld();

(aroint) #7

That’s weird. I open the combo box, then select the json option, and select the empty JSON file to. The export works well to me. Whatever you found how to use the CSV file, that’s nice. Thanks for share it.