1

In the same way that you can use JSON in javascript? At least the static properties?

Or maybe even for hash-table streaming?

Is it oversimplistic about hoping to find something like

Object.Serialize(stream) where stream is a file, overrideable with your choice of other likely candidate targets, using some default format, say XML?

With Object obj = stream.Deserialize() ...

dkretz
  • 37,399
  • 13
  • 80
  • 138
  • Soooo... What language/tools do you want that for? Javascript? – Loki Dec 11 '08 at 02:00
  • C# would be one. Since I posted this, I've been googling for "C# object serialization". There are lots of posts. They all seem to be a little bit different, with varying numbers of steps and long comment strings with problems. I'd like something on the order of "Object.Serialize(path)" – dkretz Dec 11 '08 at 06:57
  • Wouldn't it be nice to have a simple, mainstream serializer (like we have "toString()") – dkretz Dec 11 '08 at 06:58

2 Answers2

1

Java supports this with the XMLEncoder since 1.4. The format is quite compact and XMLEncoder allows to override the serialization of specific object classes, so you can use the default where it fits and do whatever you want to elsewhere.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
0

I suggest you look at XStream for .Net. I haven't used that variant, but found the original XStream quite straightforward to use in Java.

joel.neely
  • 30,725
  • 9
  • 56
  • 64