serialization

How to get key value pairs from DataContractJsonSerializer?

the correct format for my keyvalue pairs is { "Fields": { "key1": "value1", "key2": "value2" } } But I cannot get this out of my object using the DataContractJsonSerializer, does anyone know how. [DataContract] class Product { [DataMember] public Dictionary<string, stri...

How do I add x-number HTML-formatted items to my page?

I'm trying to use PHP to do this: <if !empty($list) {echo . . . ?> And get the result: Additional options: <p><input type="checkbox" name="1">1</input></label></p> <p><input type="checkbox" name="2">2</input></label></p> . . . <p><input type="checkbox" name="n">n</input></label></p> </legend> </fieldse...

How to correct deserialization errors in a DataTable Visualizer.

I am writing a Debugger Visualizer for a DataTable to display the datatable as xml instead of in a grid. I am getting an error on the line: DataTable dt = (DataTable)objectProvider.GetObject(); The exception is "Exception has been thrown by the target of an invocation." with an Inner Exception of "Failed to enable constraints. One ...

how to find un serialized objects in application.

Hi, I am working with WebSphere and Struts hiberntae technology. My onsite team reported serialiazation problem while they were working.But i didn't faced the problem in my machine. Is there anything should i need to configure in server to figure out such errors? ...

Does Boost.Serialization serialize differently on different platforms?

I use Boost.Serialization to serialize a std::map. The code looks like this void Dictionary::serialize(std::string & buffer) { try { std::stringstream ss; boost::archive::binary_oarchive archive(ss); archive << dict_; buffer = ss.str(); } catch (const std::exception & ex) { throw DictionaryException(ex.what()); ...

java.lang.IllegalStateException: Cannot deserialize BeanFactory with id org.springframework.web.context.WebApplicationContext

When I stop my server I get this exception: SEVERE: Exception loading sessions from persistent storage java.lang.IllegalStateException: Cannot deserialize BeanFactory with id org.springframework.web.context.WebApplicationContext:/Life: no factory registered for this id at org.springframework.beans.factory.support.DefaultListableBean...

JACKSON JSON custom deserializer

Hi, I am using Jackson library's ObjectMapper for deserializing JSON into JAVA objects. I am using Spring 'wiring'. I have created custom deserializers to do the conversion from JSON string to POJO. However, when the input is bad (eg. a number is passed as "124A" - illegal character) a default deserialiser is invoked and bombs with the ...

Assigning value to serialized attribute causes SerializationTypeMismatch

I find it surprising that this has not been asked yet, so I am hoping I am doing something fundamentally wrong and help will arrive soon. I have this create_table "foo", :force => true do |t| t.text "bar", :null => false ... end class Foo < AR::Base serialize :bar, Bar end class Bar de...

JSON array deserialization -- is the order of elements always preserved?

When deserializing a JSON array in C#/.NET, is the order of elements always preserved? Edit: The library currently being used is .NET 3.5's System.Runtime.Serialization.Json.DataContractJsonSerializer ...

Consuming a WDDX REST-ish API with WCF

I've got some somewhat old school web services that I need to talk to. They are somewhat REST-like, in that they are called with regular GET and POST HTTP requests, and return WDDX-formatted data in the response body. The consumer code in this instance is .NET. Ideally, I'd like to use WCF to take advantage of all of its magic. The stic...

How to Deserialize JSON back to objects created from db.Model

I want to do something like this guy asked, but I want to deserialize instead of serialize. http://stackoverflow.com/questions/2114659/how-to-serialize-db-model-objects-to-json Is there a library for this? I'm running Google App Engine, and I'm getting a JSON string from appengine-rest-server (http://code.google.com/p/appengine-rest-se...

How to customize XML serialization output for Object?

I have customizable object class I'd like to serialize: public partial class CustomObject { public List<CustomProperty> Properties; } public class CustomProperty { public object Value; [XmlAttribute] public string Name; } // some class to be used as a value for CustomPropert...

Can XmlSerializer.Deserialize ever return null?

I ve been trying in a few different ways to get XmlSerializer.Deserialize to return null however it doesnt seem possible I tried with a class being null, malformated xml, well formatted xml . I might be missing something obvious here, but is it possible ? Just to clarify give a Class MyClass that is serializable I want a similar test ...

Serialization How to dynamicly ignore all members of a specific type

I want to ignore all elements of Dictionary while serializing as those members cause an exception example class: public class TestClass{ public string StringTest { get; set; } public int IntTest { get; set; } public Dictionary<int, string> someDictionary { get; set; } } What i tried(unsuccessfull) XmlAttributeOverrides x...

Serializer that sees private data, has parsable output, supports generic collections, and supports custom serialization

I need a very specific kind of .NET serializer. My requirements: shouldn't skip private data output should be human-readable (or at least, easily parsable), preferably XML should support generic collections (no need to be easy, but it should be possible) should support custom-implemented serialization for specific classes. I need (2...

Where can I find a serializer for F# discriminated unions?

I need to persist an abstract syntax tree represented using F# discriminated unions to a human readable compact format, such as the format already used in the F# language to construct discriminated unions, that I can read back in to discriminated union instances later. I'm a bit surprised the F# library doesn't support this as it surely ...

From java object to xml object

Hi, I've created a web service client from a WSDL file with Axis. This webservice responses with an Axis object that I need to convert to com.bea.xml.XmlObjet. The reverse operation (XmlObject to Java Object) was easily made with Xpath (in weblogic workshop) and the setters of the object but I've been unsuccessfully trying to convert th...

Store a large PHP array, plain php, or gzipped serialized data?

I have a static large array-of-arrays, witch represents tree structure with about ~100k nodes, this array is only read-only reference for value lockups. Now, witch of this methods will perform better? First, simply array definition in pure PHP file, for including in requests Second, serialize this array, gzip serialized output, and lo...

How do I update a deserialized entity using NHibernate?

Let's say I have an entity like so: public class Product { public virtual int Id { get; set; } public virtual int Name { get; set; } } A client wants to update the name of a particular product, so he sends this JSON back to an ASP.NET server: { "Id": 1, "Name": "Updated Product Name" } I then run this code to try an...

MetaLinq vs MSDN's ExpressionTreeSerialization

Hi, There are two available solutions (that I could find) that have the ability to serialize expression trees: MetaLinq which has some other awesome features Expression Tree Serialization on MSDN Code Gallery which seems to be more lightweight I have little experience with these tools, so I can't decide whichever is the better. I'm ...