serialization

writing junit test to cover cross version serialization

does any of you have any info/idea on how can I test my application for cross version compatibility. I am testing these object's serialization in current "HEAD" version. but I need to wait for my integration testing to see if I broke anything cross version. I am guessing I will need to store the objects serialized from last released ver...

Serialize an object to string

I have the following method to save an Object to a file: // Save an object out to the disk public static void SerializeObject<T>(this T toSerialize, String filename) { XmlSerializer xmlSerializer = new XmlSerializer(toSerialize.GetType()); TextWriter textWriter = new StreamWriter(filename); xmlSerializer.Serialize(textWrite...

Use class name as root key for JSON Jackson serialization

Suppose I have a pojo: public class MyPojo { int id; public int getId() { return this.id } public setId(int id) { this.id = id } public static void main(String[] args){ MyPojo mp = new MyPojo(); mp.setId(4); ObjectMapper mapper = new ObjectMapper(); mapper.getSerializationConfig().set(Serializat...

Put objects which are decorated with [DataContract] into a StateServer?

Is there anyway to stick objects which are decorated with DataContract attributes but not decorated with Serializable attributes in to a SqlServer StateServer? In other words, I would prefer not having to decorate these objects with the Serializable attribute as I will also have to implement IXmlSerizable on all of these objects because ...

Executing untrusted code

Hi, I'm building a C# application which uses plug-ins. The application must guarantee to the user that plug-ins will not do whatever they want on the user machine, and will have less privileges that the application itself (for example, the application can access its own log files, whereas plug-ins cannot). I considered three alternativ...

Transport Database Query through Web Services without using Dataset

Understanding that passing Datasets through web services is a bit heavy (and almost if not completely unconsumable to non .NET clients) what is the best way to prep database query results that don't map to known types for transport through web services in c#? ...

JSON serialization of c# enum as string

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "name". Is there a way to get the enum as a string in my json without having to create a custom JavaScriptConverter? Perhaps there's an attribute ...

How can a Delphi TForm / TPersistent object calculate its own construction and deserialization time?

For performance tests I need a way to measure the time needed for a form to load its definition from the DFM. All existing forms inherit a custom form class. To capture the current time, this base class needs overriden methods as "extension points": start of the deserialization process after the deserialization (can be implemented by ...

XAML Deserialization problem

I have a block of XAML of which i'm trying to deserialize. For arguments sake lets say it looks like below. <NS:SomeObject> <NS:SomeObject.SomeProperty> <NS:SomeDifferentObject SomeOtherProp="a value"/> </NS:SomeObject.SomeProperty> </NS:SomeObject> Of which i deserialise using the following code. XamlReader.Load(File.OpenRe...

Serialization via J2ME or BlackBerry APIs.

Is it possible to serialize an object into a string or a byte array using either the J2ME or BlackBerry APIs? Thanks. ...

Why do transfer objects need to implement Serializable?

I realized today that I have blindly just followed this requirement for years without ever really asking why. Today, I ran across a NotSerializableException with a model object I created from scratch and I realized enough is enough. I was told this was because of session replication between load-balanced servers, but I know I've seen o...

How is it that json serialization is so much faster than yaml serialization in python?

I have code that relies heavily on yaml for cross-language serialization and while working on speeding some stuff up I noticed that yaml was insanely slow compared to other serialization methods (e.g., pickle, json). So what really blows my mind is that json is so much faster that yaml when the output is nearly identical. >>> import ya...

How can I transfer a hash using client and server in Perl?

I just want to transfer (send or receive) a hash from client to server. Can you tell me which is a preferable way in Perl or can you suggest any CPAN modules? ...

Why my WCF Service returns xml serialized objects?

Hi, I'm new here and I hope anyonte can help me. I have WCF Service and Windows Forms working with this client written in VB.NET. The Service class started to return xml serialized objects, but all my classes on Service side are DataContract-s and the service class is DataContractFormat. I googled everywhere about serializations and I ...

a question about serialization

What is a better approach to serialize custom class: using XMLSerializer or BinarryFormatter and [Serializable] attribute on class? ...

Application configuration save to file or object serialization

Hi, I am working on a project and I need to save user configuration. The configuration is a set of Jchechboxes I need to store their state (true, false). Which do you think is the better way of saving it, in a file and if yes in what (ini, cfg, txt), or it is better to serialize the object with the states?? Or if there is another way, pl...

Silverlight/Web Service Serializing Interface for use Client Side

I have a Silverlight solution that references a third-party web service. This web service generates XML, which is then processed into objects for use in Silverlight binding. At one point we the processing of XML to objects was done client-side, but we ran into performance issues and decided to move this processing to the proxies in the ...

Can I serialize a BitArray to XML?

Hello I have a business class which I need to serialize to xml. It has a BitArray property. I have decorated it with [XmlAttribute] but the serialization is failing with To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.Boolean) at all levels of their inheritance hierarchy. System.C...

XStream <-> Alternative binary formats (e.g. protocol buffers)

We currently use XStream for encoding our web service inputs/outputs in XML. However we are considering switching to a binary format with code generator for multiple languages (protobuf, Thrift, Hessian, etc) to make supporting new clients easier and less reliant on hand-coding (also to better support our message formats which include bi...

how to serialize a DataTable to json or xml

Hello, i'm trying to serialize DataTable to Json or XML. is it possibly and how? any tutorials and ideas, please. For example a have a sql table: CREATE TABLE [dbo].[dictTable]( [keyValue] [int] IDENTITY(1,1) NOT NULL, [valueValue] [int] NULL, CONSTRAINT [Psd2Id] PRIMARY KEY CLUSTERED ( [keyValue] ASC )WITH (PAD_INDEX ...