serialization

Problem serializing DecimalFormatSymbols in 2.3.4

笑着哭i 提交于 2020-01-24 12:29:26
问题 I have some code where I am serializing one of my classes that contains a DecimalFormat number. This worked up until 2.3.4. How can I resolve? ERROR/AndroidRuntime(684): java.lang.IllegalArgumentException: no char field 'exponential' Here is the class that I am serializing: public class Quote implements Serializable { private static final long serialVersionUID = 1L; private String symbol; private String name; private String change; private String percentChange; private String open; private

WCF Service contract to be both XML and Json serialized

只谈情不闲聊 提交于 2020-01-24 10:38:14
问题 How can I create the service contract to be in XmlSerializerFormat as well as WebMessageFormat.Json within a WCF RESTful service. What I need is to call the "CallADSWebMethod" operation contract from code behind of ASP.Net 1.1 which needs to be XML serialized and from jQuery ajax which is Json serialized. SERVICE CONTRACT [ServiceContract, XmlSerializerFormat] public interface IService { [OperationContract, XmlSerializerFormat] [WebInvoke(UriTemplate = "/CallADSWebMethod", Method = "POST",

Ignore missing types during deserialization of list

时光怂恿深爱的人放手 提交于 2020-01-24 10:29:33
问题 When deserializing a list with TypeNameHandling.All , if a type namespace for one of the items is missing (deleted after serialization), it will cause a Error resolving type specified in JSON error. I wish to ignore these items instead, leaving the rest behind. Error = (sender, args) => { args.ErrorContext.Handled = true; } in JsonSerializerSettings does what I'm looking for, but will capture ALL errors of course. Is there a cleaner way of doing this, maybe via a serializer setting I've

Unable to find assembly

折月煮酒 提交于 2020-01-24 07:49:24
问题 I'm Serializing an ArrayList to a binary file in order to send it across TCP/IP. The serialized file is created by the server and I hope to be able to deserialize it with the client that I'm writing at the moment. However, when the client attempts to deserialize it throws a SerializationException because it can't find the assembly (presumably) which serialized the file to begin with. How do I get around this? 回答1: Does your arraylist contain custom data type (i.e. your own classes)? The

Xml serializing and deserializing with memory stream [duplicate]

╄→гoц情女王★ 提交于 2020-01-24 04:44:40
问题 This question already has answers here : Root element is missing (5 answers) Closed 4 years ago . I'm getting an error with the following code where it can't find a root element when it tries to deserialize the code: An exception of type 'System.InvalidOperationException' occurred in System.Xml.dll but was not handled in user code Additional information: There is an error in XML document (0, 0). Inner exception: {"Root element is missing."} It seems straightforward enough code, but googling

BigDecimal can't be coerced into BigDecimal

こ雲淡風輕ζ 提交于 2020-01-24 03:32:27
问题 This should be pretty simple, yet it's blowing up. Any ideas? d = BigDecimal.new("2.0") YAML::load({:a => d}.to_yaml) TypeError: BigDecimal can't be coerced into BigDecimal from /Users/benjohnson/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/inspector.rb:86:in `inspect' from /Users/benjohnson/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/inspector.rb:86:in `inspect' from /Users/benjohnson/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/inspector.rb:86:in `block in <module:IRB>' from /Users

Should I Still Use BinaryFormatter for Simple Serialization in .NET 4.0?

一笑奈何 提交于 2020-01-24 03:05:47
问题 I am developing a master-slave style application. The master application will send state data to the slave(s) to process and display at some constant rate. The state data is wrapped up into a single class that contains many fields. These field types consist of primitives, classes, interfaces, lists of interfaces, and so on. All the types are either BCL or custom types, so the the custom types can be modified if necessary. Both the master and and slave applications will be .NET 4.0. I am not

Should I Still Use BinaryFormatter for Simple Serialization in .NET 4.0?

筅森魡賤 提交于 2020-01-24 03:05:38
问题 I am developing a master-slave style application. The master application will send state data to the slave(s) to process and display at some constant rate. The state data is wrapped up into a single class that contains many fields. These field types consist of primitives, classes, interfaces, lists of interfaces, and so on. All the types are either BCL or custom types, so the the custom types can be modified if necessary. Both the master and and slave applications will be .NET 4.0. I am not

Deserialize Json from file in C#

别来无恙 提交于 2020-01-24 02:52:10
问题 I've managed to find a solution without removing the paths from the keys. Thanks for the help guys, and also pointing out problems, I really appreciate it! :) Loaded the Json to a string, deserialized it into a dynamic, ran a foreach through it, and added to a List with ResFiles in it. static void loadJson() { List<ResFile> fileList = new List<ResFile>(); string jsonString = File.ReadAllText(jsonPath); dynamic files = JsonConvert.DeserializeObject(jsonString); foreach (var f in files.objects)

Deserialize Json from file in C#

做~自己de王妃 提交于 2020-01-24 02:52:05
问题 I've managed to find a solution without removing the paths from the keys. Thanks for the help guys, and also pointing out problems, I really appreciate it! :) Loaded the Json to a string, deserialized it into a dynamic, ran a foreach through it, and added to a List with ResFiles in it. static void loadJson() { List<ResFile> fileList = new List<ResFile>(); string jsonString = File.ReadAllText(jsonPath); dynamic files = JsonConvert.DeserializeObject(jsonString); foreach (var f in files.objects)