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
I have a very fast open source JsonSerializer available that can serialize any POCO or DataContract type, including Interfaces anonymous and late bound types, etc.
Basic Example
var customer = new Customer { Name="Joe Bloggs", Age=31 };
var json = JsonSerializer.SerializeToString(customer);
var fromJson = JsonSerializer.DeserializeFromString<Customer>(json);
JsonFx.NET has an open-source serializer which allows serialization to/from strongly typed classes which might be what you're looking for. You can control how dates are serialized and override many aspects of the serialization. It even interacts well with Linq by supporting serialization of anonymous objects. The API works just like .NET XML serialization.
Json.Net is a JSON library for .NET. It is available in CodePlex.
just use your own api.. its easy to create json.. but you can also use JSON libraries like JSON.NET..
happy coding
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 uses new
- 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.
LINQ To Json can serialize and deserialize.