serialization

Serialization and versioning

Hi, I need to serialize some data to string. The string is then stored in DB in a special column SerializeData. I have created special classes that are used for serialization. [Serializable] public class SerializableContingentOrder { public Guid SomeGuidData { get; set; } public decimal SomeDecimalData { get; set; } publi...

android: can't write to files dir but can in package dir

I'm trying to save an object in a file but the file doesn't appear on the device and I don't get an exception either. public static void save(Context ctx) { Log.i("App serialization", "Saving to settings.ser: " + ctx.getFileStreamPath("settings.ser")); FileOutputStream fos = null; ObjectOutputStream out = null; try { ...

Xml to Json Conversion using Newtonsoft Json.Net: Removing @ prefix?

I am using Newtonsoft Json.Net to convert Xml to Json. Following Xml <root> <person id="1"> <name type="first">Alan</name> <url>http://www.google.com&lt;/url&gt; </person> <person id="2"> <name type="last">Louis</name> <url>http://www.yahoo.com&lt;/url&gt; </person> </root> Is converted to following Json. { "root":...

Is it possible to retain custom attributes in a class instance after deserialization?

I'm trying to build a custom HTML helper for MVC.NET that would allow me to render object entities (Model Objects) as HTML forms. So I decided to do it using custom attributes such as html input type, readonly flag, css classes, etc. Similar in a way to LINQ Mapping attributes that set database related bindings for Table and Column. So I...

Error while deserializing XML from SQL Server

I have an application which serializes and deserializes .NET objects to XML. While deserializing I am getting the following error: "There is an error in XML Document(1,2) Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2. " The code snippet that does the deserializing is: string xmlEntity ...

XML Serialization in C#

Hello, Where Can I find good tutorial about XMl serialization to the object? Thanks. ...

How do I register types with boost serialization in a template class?

I am having a problem where I am trying to serialize a message of a template class. The template's class message is of type BaseClass, but I want it to serialize the derived versions of the class. As of right now, it is only serializing the BaseClass. How am I supposed to register with boost::serialization the types of the derived classe...

Including XML Comments in DataContract Serializer Metadata

is there some way of sending the summary info of properties in a DataContract? e.g. [DataContract] public class MyClass { /// <summary> /// My Summary information /// </summary> [DataMember] public int MyProperty {get;set;} } can this be available to the client that gets the datacontract? I doubt it, just hoping somebody kn...

PHP Unserialize Offset Error

I have this code: $serialized = $_POST['cartSer']; echo $serialized; Which prints this: a:1:{s:15:\"test\";s:3:\"999\";} I then add this code: echo unserialize($serialized); And end up with this error: Notice: unserialize() [function.unserialize]: Error at offset 5 of 43 bytes in /mypage.php on line 5 What am I doing wrong ...

Faster Deserialization in Python

What do you think is the fastest deserialization method? Pickle? YAML? or JSONPickle? ...

C# XML De serialization and arrays.

Hello, There is next xml file: <element Name="root"> <SubFields> <element Name="subroot"> <SubFields> <element1 Name="element1" customatt1 = "12313" customatt2 = "asdfasfadsfasd"> <subelement Name="subelement" /> </element1> <element1 Name="elem...

Groovy/Grails JSON converting of complex objects and collections.

I have following mapping representing categories tree: class Category { String name static belongsTo = [parent: Category] static hasMany = [categories: Category] } The thing I want to do is to render all of the category tree and exclude field parent from rendering. render category as JSON renders only first level of hiera...

Using Json and jQuery to populate DropDown from a list of custom classes in Asp.Net MVC 2

I'm trying to populate a DropDown from a Json result using jQuery. I have the following class: class MyOption { int Id { get; set; } string Name { get; set; } } I'm not sure how to get a list of these into my Json result. At the moment I have the following, I'm not sure if it's correct but it compiles and runs: return Json(...

IPhone SDK - How to serialize ABRecord?

Hi! I'm new in iPhone development, can you advice me how to serialize AdressBook records? I have read stackoverflow - How do I serialize a simple object in iPhone sdk, but I still have questions: should I extend ABRecordRef? Is it possible? Or should I implement own class NSObject? (similar question was on Mac forums and was left with...

WCF - Memory problems when deserializing a large streamed objects

Here's my situation - I have a simple object model. At the root, there's a Report object. Reports have an array of Documents. Each document has an array of Chapters and Page. Each of these objects has 4 or 5 properties (primitives - strings and integers). It looks something like this: Report List< Document> List < Chapter> List ...

XML Serialization/Deserialization per item

hey I'm designing a car catalogue and need to use XML files for storage. In previous projecs, I was manually editing XML files with Linq. However, I came across XML serialization and am thinking this might be a better approach. Each item in the catalogue would be of type CarItem and contain various attributes. The catalogue can contain ...

System.Runtime.Serialization.InvalidDataContractException in production environment , not in test environment

I’m moving a web service from our test environment to our production environment, and am installing it under “services” The web service works fine in test, but in prod I get this error: “System.Runtime.Serialization.InvalidDataContractException: Type ‘CustomClass' cannot be serialized. Consider marking it with the DataContractA...

scala serialization

When I try doing the serialization examples from Ruminations of a Programmer's "JSON Serialization for Scala Objects" article I run into the error: Exception in thread "main" java.lang.NoClassDefFoundError: scala/util/parsing/syntax/Tokens. I have found that it happens when trying to deserialize. I was just wondering if there was a sim...

Sanitize XML Attribute Values

How can i easily sanitize the values I pass into the Value property of an XAttribute. ...

How can I customize the deserialization of JSON in ASP.NET MVC?

I have a controller action that is receiving a complex object via JSON. The object has a property on it that is declared as an abstract type. Currently, the action method never gets executed because when the JSON object is deserialized it chokes on the abstract type. How can I customize the deserialization phase so that I can supply th...