You’d have to fork Tiled and change the code writing the properties in mapwriter.cpp and mapreader.cpp to achieve what you want. It should not be that complicated, but note that Tiled allows any characters to be part of the property name. If you use your alternative suggestion, you’ll need to make sure they are valid XML attribute names.
Why do you want to do this?
Seems like it was because you didn’t put the ``` on their own line.
Thanks for your response! The reason for my wanting to change the formatting may be due to a lack of understanding of Xml, but I’ve been getting a little frustrated with the way the data appears. I’m importing my Tiled map into Unity using C#. When trying to serialize the information, the code requires a lot of extra steps.
Two examples of the problems I’m having lately:
There are a lot of nested XmlElements that I have to go through to make sure all of my Xml data is being serialized properly. In the below example, if I want to reach the property attribute “duration”, I need to serialize the Map, ObjectGroup, Object, Properties, and Property elements. Then I’m able to go into the attribute I’m looking for. It’s not a deal breaker or anything, but it’s definitely a longer process than I’d like.
The individual properties create extra work to ensure that the name and the value match up in my code. Instead of being able to serialize “duration” and set it’s value to 1, I have to go into each property, check the name and also check it’s value. I feel that it would be easier to list each attribute in the “properties” element. This way, I can find all of the information I need right there.
I do appreciate you letting me know where this code can be changed! These small things aren’t deal breakers, rather than quality of life improvements. I’m not sure that I’ll be making any changes any time soon, but I’ll definitely look into it in the future to see how I can optimize for myself.
Usually you first convert the data from XML into some other structure that is useful for your purposes. In C#, I guess you’d use a Dictionary for the properties. This should be a simple loop over the property children of the properties element in your map loader, after which you can stop worrying about whatever structure the XML was in and just look things up from the dictionary you associated with each object.
Btw, “serializing” is the other direction, for example moving data into XML, JSON or some other type of byte array. I think you just meant “looking up”.