Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Updated WorldSaver (and made a few small bugfuxes for WorldArea and ConnectedWorld):
Added a new JsonData type, that can be used to more easily load / save json files
Use JsonData.FromJson(string json) to get the JsonData from a json string
Use JsonData.FromObject(object json) to get the JsonData from an object (only some types are supported)
Use JsonData.FromObject(object json) to get the JsonData from an object
You can implicitly convert a few supported types to JsonData objects
You can explicitly convert the JsonData objects back to their original types
Each JsonData has a Type string
To convert the JsonData back to a string, use (data).ToString(bool neatified)
To convert the JsonData back to an object, use (data).ToObject()
Offline
If you wish to support more objects without extra, I'd suggest JSON.NET. Even in the C# documentation they say JSON.NET is better than their implementation.
Although JSON.NET does work for custom single constructor objects (serializes all public properties and fields), your users would still have to implement JSON.NET themselves for more control (ignore certain fields, include private fields, specify a certain constructor when multiple constructors implemented).
Hope it's of help (sorry I came so late with this one, started using it myself only recently).
Offline
If you wish to support more objects without extra, I'd suggest JSON.NET. Even in the C# documentation they say JSON.NET is better than their implementation.
Although JSON.NET does work for custom single constructor objects (serializes all public properties and fields), your users would still have to implement JSON.NET themselves for more control (ignore certain fields, include private fields, specify a certain constructor when multiple constructors implemented).
Hope it's of help (sorry I came so late with this one, started using it myself only recently).
I don't really like the JSON deserialisers that deserialise to a user defined object, I prefer it if they are converted to dictionaries and lists (I'm not sure if JSON.net can do this or not).
Also I like to be able to control the whitespace (In pretty much all other deserialisers, they put everything on its own line, but with the world data, I wanted it to format it so you could read (the block arrays) it in a text editor).
Another reason I didn't use a library is that I store the world data differently in this library than I do in JSON, to make the file size smaller, and the library speed faster, so I would have to do a lot of formatting anyway.
I don't think any other library has all these features, so I decided to just make it myself.
Offline
JSON.net does support dicts, lists and arrays, obviously, and objects are basically stored as JSON objects with basically dict-like content.
As far as I can see this quickly you can specify whether you want it nicely indented or on a single line, although I couldn't find any method of doing multiple formats in a single object (single line for 2nd dimension of arrays, all the rest indented, what you currently have).
You actually can create your own formatter to write your objects in a different format, or you'd just have to put it into a different object that would match your JSON format before serializing it.
But alright, 't was a suggestion, up to you if you use it or not (can also understand it might seem like too much work to change everything now).
Offline
As far as I can see this quickly you can specify whether you want it nicely indented or on a single line, although I couldn't find any method of doing multiple formats in a single object (single line for 2nd dimension of arrays, all the rest indented, what you currently have).
You actually can create your own formatter to write your objects in a different format, or you'd just have to put it into a different object that would match your JSON format before serializing it.But alright, 't was a suggestion, up to you if you use it or not (can also understand it might seem like too much work to change everything now).
It probably wouldnt be too hard to change things, but it probably wouldnt be worth the effort, as what im doing now pretty much does everything I need it to do. I might add something to change an arbritrary class to the Dictionary<string, JsonData> format some time, but other than that I think it mostly works already.
Offline
[ Started around 1732960133.7788 - Generated in 0.209 seconds, 12 queries executed - Memory usage: 1.45 MiB (Peak: 1.56 MiB) ]