Insert data into json table with tiled

Hi, sorry for my google english.

I created a table in json to save the levels of my game, I created it in SDK crown.
Does anyone know how to insert data into a json table from a Tiled map editor map? What I intend is to change a field from the custom attributes:

levels [2] = 2

and inserts it to me as text:

“levels [2] = 2”

The result should be this:
before inserting:

{“levels”: [1,1,1,1]}

After inserting from Tiled:

{“levels”: [1,2,1,1]}

I hope I explained myself well.
Can someone please help me?

Health @ s


Hmm, you’d need to put some code in your game that evaluates that statement in the right context.

The custom properties are properties rather than arbitrary code. Any processing on those properties has to happen in your engine. This means that instead of something like map: levels[2] = 2, you should instead have something like map: 2 and level: 2, and then put that into your game’s data structure when you read in the map in your game. This should ease the parsing, and it would make these properties easier to set, since their meaning would be clear from the property names.

OK, thanks, I will use the properties of tiled to transform them into my engine´.


solved :wink:
To transform the string into numbers, I created a condition:

if == “levels[2] = 2” then
levels[2] = 2