serialization

Cannot unserialize object after storing it serialized in database!

I'm trying to store a complex object here and am doing that by serialising the object running a mysql_real_escape_string on it and inserting it into a mysql database. However when I retrieve it running a sql query - I'm using Zend frameworks Zend_DB_Table here but anyway - and when I try to stripslashes and unserialize I dont get my obj...

Problems with custom deserialization of a list in C#

I'm writing a custom deserializer that will deserialize a list by deserializing each of the individual objects in the collection and then putting it together. Basically my code looks like this: //myField is a FieldInfo that represents the field we want to put the data in //resultObject is the object we want the data to go into List<Ob...

How do I use XmlSerializer to insert an xml string

I have defined the following class: public class Root { public string Name; public string XmlString; } and created an object: Root t = new Root { Name = "Test", XmlString = "<Foo>bar</Foo>" }; When I use XmlSerializer class to serialize this object, it will return the xml: <Root> <Name>T...

boost serialization vs google protocol buffers?

Does anyone with experience with these libraries have any comment on which one they preferred? Were there any performance differences or difficulties in using? ...

Is there an alternative way of serializing javascript objects to a json string?

I downloaded the code from json.org to serialize/deserialize javascript objects to/from json and it worked just fine. However, in production, it conflicts with my other javascript code apparently because it uses for in loops. Is there another library that does this? Thanks! ...

Is there a tool to generate C# classes based off a JSON string?

I'm wondering if there is a tool out there that can take in a JSON string, analyze it, and generate a C# class file that can then be used to deserialize the json string into a C# object of that class. I'm looking for something similar to a code generator of sorts, but the input would be a JSON string, instead of a database table/view/wh...

How to serialize a collection as an alphanumeric string?

Hi, I need to express a collection of about 10-15 short strings (and maybe some ints) as a fairly compact alphanumeric string - one which I can send as a parameter in a get request. Basically, I'm thinking that my collection will be a hashtable, and I'd like to serialize it so it looks sort of like a viewstate string (only hopefully not...

How to add the constraint of being serializeable to a .NET generic class' type parameter?

Hi! Is there a way to declare that the variable type of a generic class must be serializable? Best RegardsOliver Hanappi ...

DateTimeOffsetAdapter interfering with WCF serialization of DateTimeOffset objects

I have a WCF service reference (= client proxy) generated by Visual Studio 2008 (.net 3.5 sp1). The generated code contains a data contract with DateTimeOffset properties so naturally VS decorated it with KnowTypeAttribute(System.DateTimeOffset). Whenever I invoke a WCF operation that returns the above mentioned data contract, I get th...

How to deserialize xml data from c# to java?

I have identical objects in both a c# server app and a java client app. The server XML serializes these objects and makes them available through a REST service. The java app downloads the data in XML format. What is the best way to deserialize the xml data to my java objects? I am currently using Java org.w3c.dom classes to parse the ...

why does unserialize in PHP keep returning false?

I've just written the easiest script in the world, but still I can't get it to work, and it's mighty strange. Here's the deal, what I want to do is to use jQuery to catch some input field values and serialize them with jQuery's serialize(); I then send the serialized string to the server to unserialize it. Here's the output I get from th...

handling Java custom serialization with multiple versions of serializer classes?

I have a custom data storage format I'm implementing on top of either HDF5 or NetCDF. My data format evolves occasionally (but rarely), and it is important to be able to read "old" files later. I had been using C++ and Microsoft COM but have abandoned those toolkits in favor of Java. In my COM days, I could put the CLSID of the data for...

Mono, Serializable Objects with MarshalByRefObject

I'm attempting to port a C# application to .NET (client server), and am running into issues with serialization. The Linux client serializes and object, but the Windows server is unable to deserialize it, giving the error: System.Runtime.Serialization.SerializationException Field "MarshalByRefObject+__identity" not found in class Deser...

DataContractSerializer doesn't call my constructor ??

I just realized something crazy, which I assumed to be completely impossible : when deserializing an object, the DataContractSerializer doesn't call the constructor ! Take this class, for instance : [DataContract] public class Book { public Book() { // breakpoint here } [DataMember(Order = 0)] public string Title {...

Deserialized object instance without class definition.

In anyone aware of a tool/script/program/whatever to create a java object instance from a binary java serialized object? I don't have the .class file, so I can't ( afaik ) simply create an ObjectInputStream and load it from there. This object has the default serialization mechanism, and I'm trying to debug a problem we have. Anyone? ...

C# - How to xml deserialize object itself?

public class Options { public FolderOption FolderOption { set; get; } public Options() { FolderOption = new FolderOption(); } public void Save() { XmlSerializer serializer = new XmlSerializer(typeof(Options)); TextWriter textWriter = new StreamWrit...

How to mimic built-in .NET serialization idioms?

I have a library (written in C#) for which I need to read/write representations of my objects to disk (or to any Stream) in a particular binary format (to ensure compatibility with C/Java library implementations). The format requires a fair amount of bit-packing and some DEFLATE'd bytestreams. I would like my library, however, to be as i...

Serializing LINQ-objects to JSON-strings - HUGE strings

Hey, I am using LINQ to access my database, and thereby gets a LINQ-created object which I want to send to the browser (this is a webservice) as a JSON-object. This works well by now, but when I add some testdata to the database (about 10-20 entries in each table) this fails miserably. The reason is that the LINQ-object contains all the...

C# Web Services & Nested Complex Types

So I've been using this code to automatically serialize my "User" business object which has been working great. [WebMethod] public MyUser GetUserFromCard(string code, string cardNumber) { var repo = new MyRepositry(cinemaCode); string parameters = string.Empty; parameters = MyRepositry.MakeParameter("CardNumber", cardNumber)...

XML vs Binary performance for Serialization/Deserialization

I'm working on a compact framework application and need to boost performance. The app currently works offline by serializing objects to XML and storing them in a database. Using a profiling tool I could see this was quite a big overhead, slowing the app. I thought if I switched to a binary serialization the performance would increase, bu...