serialization

Cross-platform and language (de)serialization

I'm looking for a way to serialize a bunch of C++ structs in the most convenient way so that the serialization is portable across C++ and Java (at a minimum) and across 32bit/64bit, big/little endian platforms. The structures to be serialized just contain data, i.e. they're pure data objects with no state or behavior. The idea being th...

Web Method is returning XML, how should I read data from xml?

I have added web service reference in visual studio. I am able to see xml return value from web method. How should I read data from returned XML of service? ...

How to format some ASP.NET MVC Json result?

Hi folks, i've got a really simple POCO (business) object which I'm returning to the client as some json, using ASP.NET MVC. eg. (please ignore the lack of error checking, etc). public JsonAction Index() { Foo myFoo = MyService(); return Json(myFoo); } kewl. Now, this object includes following public properties... public cl...

Eager fetching of an object

I am Serializing an object which has a deep hierarchy of objects. After deserialization, i am able to access only those fields which were available in object before serialization. For rest, i get LazyInitializationException. class A { List<B> objs } class B { C c } class C { D d } Initially, i used to get LazyInitiali...

Spring IoC: What about serialization?

Hi StackOverflow! I am just in the middle of the development of a new software component involving the Spring Framework. I like it but now i have a question regarding IoC and serialization. Given i have this class (Omitted imports and package declaration): public class EMailNotificationEndpoint implements NotificationEndpoint { priv...

Deserialization in debug mode ??

Can anyone explain why the following is happening: When we serialize a file in debug mode, we can open it again in debug mode, but not at runtime. When we serialize a file in runtime mode, we can open it again in runtime mode, but not at debug mode. Now I know you're gonna say: thats because they have different assemblies. But we use a...

How can I exclude some public properties from being serialized into a JsonResult?

Hi, I have a custom viewmodel which serialized using a JsonResult. The ViewModel has some properties which have to be public, but at the same time these properties should not be visible in the resulting Json output. I've already tried using the [NonSerialized] attribute, but that did not seem to have any effect. Is there any simple w...

jQuery plugin that deserializes XML?

Is there an XML deserializer for javascript? Preferably in the form of a jQuery plugin. ...

C# String Array Deserialization Problems

I'm having a really strange issue serializing to an MSMQ and back. The object being serialized contains a string array; one of the strings in the array contains spaces and carriage returns ("\r\n"). The object is constructed fine and seems to serialize without a problem, but when I deserialize it (in another project), the array now con...

Clone Linq object Error "Object graph for type 'TestLinq.PersonAddress' contains cycles and cannot be serialized if reference tracking is disabled."

Hi to all I Need to clone row using linq. i found this method: public static T Clone<T>(this T source) { var dcs = new System.Runtime.Serialization .DataContractSerializer(typeof(T)); using (var ms = new System.IO.MemoryStream()) { dcs.WriteObject(ms, source); ...

byte[] to ArrayList ?

Could somebody tell me how can I convert byte[] to ArrayList by using C# under Windows Mobile? Later edit: this would go like having an ArrayList containing instances of a custom type. This list goes to a database (into a blob) as a byte array (the conversion is done by the database API); What I want is to revert the byte[] to ArrayL...

When serializing a custom generic collection to Xml how do I add an attribute to the generated collection element.

When serializing a custom generic collection to Xml how do I add an attribute to the generated collection element. Currently I have: <RootObject> <Id>1</Id> <Items> <MyCollectionItem/> <MyCollectionItem/> </Items> </RootObject> What I need is: <RootObject> <Id>1</Id> <Items Name="My collection name"> <MyCollec...

Issue with deserialization of a static property in .Net

I have a class called Test which has four public properties and one of them is static. the problem is after deserialization the static property contains null value. i have debugged the code and found that at server side it contains the value which is a collection , but at client side it becomes null after deserialization. i know static m...

Java serialization problem

I would like to change my qestion to the following: I have one HashMap object, and one int. I want to serialize the into the same file and get back. I know that I should do deserialization in the same order as I have done serialization. Please provide me with a code which performes that action. ...

VB.NET Serialization Missing dot right before new line serialization

Hey guys, I've been using XML serialization for a while, and today I realized something really odd. If I have a new line right after a "dot" (.), when i deserialize, I lose the dot. Has anyone ever had this happen to them? The following is my serialization code: Serialize Dim xmlSerializer As New System.Xml.Serialization.XmlSerializer...

Store QList<T> in QVariant and stream to QDataStream?

Hi, Here's the demo code: QList<Custom> L; QVariant v(QVariant::fromValue(l)); QDataStream d; d << v; The problem seems to be that d doesn't know how to stream v, because v doesn't know how to do a metatype save on L. I have registered Custom and L as metatypes and I've also registered their IO streams, but L has no meta object, and I...

C# class referenced from web service not deserializing properly

I have a web service that's serializing a class (class is from the web service) into an MSMQ, then a windows service is checking the queue and deserializing. The windows service has a web reference to get the class. If I deserialize inside the web service, everything comes out fine. However, when I deserialize from the windows service...

Immutable types as configuration properties

Is it possible to use immutable types as configuration properties with .NET's configuration API? Let's say I have an immutable type called MyClass: public class ImmutableClass { private readonly int value; public ImmutableClass(int value) { this.value = value; } public int Value { get { return ...

[JRuby] How can I make a field transient, so Java objects don't get serialized when using marshal?

I have a JRuby class which contains an instance variable that is a Java object. As you may know, JRuby has a lot of trouble serializing Java objects, and therefore I would just like to skip over the object. How might this be achieved? ...

Deserializing some JSON with JSON.NET

Hi everyone! I'm very new to JSON, and I need to parse some that an API is providing. A quick google search turned up JSON.NET, so I'm trying to use it now to parse this JSON into a list object. First of all, is JSON.NET the best library to use for this? This is what I'm trying to do: I have a class called Item, for example. The json ha...