I need to serialize/de-serialize some objects into/from string and transfer them as just opaque data. I can use XmlSerializer to do it, but generated string looks clumsy and long. So, is there any concise Serializer available in .NET?
The first thing coming to my mind is that perhaps .NET should have JSON Serializer, but I cannot find it. Is there any off-the-shelf approach in .NET to convert object to/from concise string?
There are two;
In the traditional way, they aren’t 100% compatible with each-other, especially re
DateTime; DCJS uses (IIRC) a literal string; JSS usesnew– and neither can read t’other correctly.Of course, if the text if opaque, you could also use any concise binary serializer, and simply base-64 encode it; for example, protobuf-net is pretty terse. But using JSON minimizes the external code needed at each end, so may well be your best bet.