serialization

Serialize ASP.NET Control collection

I've been tasked with converting an existing ASP.NET site from using InProc session management to using the ASP.NET State Server. Of course what this means is that anything stored in the Session must be serializable. One of the most complicated pages in the app is currently storing an ASP.NET control collection to the Session. This is...

parsing JSon using JSon.net

I'm trying to parse some JSon using the JSon.Net library. The documentation seems a little sparse and I'm confused as to how to accomplish what I need. Here is the format for the JSon I need to parse through. { "displayFieldName" : "OBJECT_NAME", "fieldAliases" : { "OBJECT_NAME" : "OBJECT_NAME", "OBJECT_TYPE" : "OBJECT_T...

PHP: __toString() and json_encode() not playing well together

I've run into an odd problem and I'm not sure how to fix it. I have several classes that are all PHP implementations of JSON objects. Here' an illustration of the issue class A { protected $a; public function __construct() { $this->a = array( new B, new B ); } public function __toString() { return j...

Deserializing JSON objects as List<type> not working with asmx service

I am having trouble deserializing my JSON string. I have a class of type person with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ASP.NET says something about not be...

Control serializer in JsonResult aka Json function in ASP.Net MVC?

Is there a way to configure what JSON serializer is used when returning JSON via the JsonResult in the controller: public ActionResult SomeJsonFunction() { var x = SomeModelCode.SomeModelFunction(); return Json(x); } It looks like the default is the JavaScriptSerializer. I would love to be able to use the DataContractJsonSerializ...

How does ruby serialization (Marshaling) work?

I have found some info on the subject (like this link), but nothing that tells me how it actually works under the covers. If you don't want to read the essay below, here are the real questions: How should I implement the marshal_dump and marshal_load methods? even a simple example will do. when marshal_load is called, how does it 'kn...

ORM Entity Xml Serialization

I am looking for an ORM to use with .net, I need to be able to do full graph serialization to Xml on the entitys the ORM generates. My own research leads me towards using the WCF and the Entity Framework to achieve this, Is this the best option or is there a simpler way ? ...

Can you control the depth of DataContractSerializer deserialization?

I have a pretty sizeable object graph that I have serialized to a file via the DataContractSerializer. I now want to present a list of these files to the user to choose from. In this list, I want to show some of the details about the file, which are properties of the root object. I don't want to load the whole graph into memory, since...

How to include extra data in the Django serializer response?

Hi, I am trying to make a livesearch with Django and jQuery. What I've done is make the javascript ask for some data with the getJSON function, then I've set up a view in Django that returns a JSON response automated by the Django serializer. And this works well, it returns a json response with the text/javascript content-type. To avoid...

Is there a good Java networking libary?

Hi folks! I'm currently searching for a Java networking library. What I want to do is sending XML, JSON or other serialized messages from a client to another client and/or client to server. My first attempt was to create an POJO for each message, plus a MessageWriter for sending and a MessageReader for receiving it. Plus socket and err...

How to stop .NET from encoding an XML string with XML.Serialization

I am working with some Xml Serialization in ASP.NET 2.0 in a web service. The issue is that I have an element which is defined such as this: <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)> _ Public Property COMMENTFIELD() As String Get Return CommentField '...

WCF contract returning interface could cause serialization issue?

I am trying to define a WCF contract that returns an interface, something like below: [ServiceContract] public interface IMyContracts { [OperationContract] IMyInterface GetData(string request); } To get this to work I think my interface (IMyInterface) would have to implement ISerializable to ensure classes implementing my inte...

Serialisation order & Unity problems

I have an application that uses an XML and custom serialiser, and have recently added some DI using Unity 1.2 to set two properties in my class. Now when I serialise the class the properties that were set by Unity are serialised first followed by all the other properties in order. So if class Properties 2 and 3 are set by Unity the ser...

explicit serialVersionUID considered harmful?

I am probably risking some downvotes on this. It seems to me that explicitly specifying serialVersionUID for new classes is bad. Consider the two cases of not changing it when layout has it should have been changed and changing it when it should not have. Not changing when it should have been changed occurs almost only when it is expl...

Is it possible to reverse the Uni-Directional behavior of a DataContractSerialization of a Linq 2 SQL object graph?

"By convention, the property on the parent side of a primary-foreign key relationship is marked for serialization. The other side in a bidirectional association is not serialized." Is it possible to somehow reverse this so that the child side serializes the parent instead? ...

Can an internal setter of a property be serialized?

Hello fellow coder, Is there any way to serialize a property with an internal setter in C#? I understand that this might be problematic - but if there is a way - I would like to know. Example: [Serializable] public class Person { public int ID { get; internal set; } public string Name { get; set; } public int Age { get; se...

Creating lightweight Linq2Sql proxy objects

I'm trying to find the most efficient way to send my Linq2Sql objects to my jQuery plugins via JSON, preferably without additional code for each class. The EntitySets are the main issue as they cause not only recursion, but when recursion is ignored (using JSON.NET's ReferenceLoopHandling feature) a silly amount of data can be retrieved...

Pure Javascript YAML library that supports both dump and load?

Does such a thing exist for YAML (aka YAML)? If this existed at one time, it must have been obliterated because the latest search turned up nada. It looks like there are plenty of implementations that dump from Javascript to YAML output only, but having trouble finding an implementation that supports both dump and load. Is anyone worki...

JSON Syntax: Transmitting an array

A valid JSON Syntax is something of the kind: { "username" : "admin", "password" : "123" } But what if I want to transmit an array of 'users' (given the example), instead of a single 'user' ? Is the code below Valid JSON, according to the specifications? [{ "username" : "admin", "password" : "123" }, { "username" : "bbvb", "password...

StackOverflowError when serializing an object in Java

I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulation is kept as an object, disconnected from Swing. I am trying to serialize my Simulation class with this code: public void saveSimulationState(String simulationFile...