deserialization

Deserialization throws 'ClassNotFoundException: JavaConversions$SeqWrapper' in Scala 2.10

柔情痞子 提交于 2019-12-11 14:04:20
问题 I have a fairly complex object graph serialized out from Scala-2.9 and I need to read it into Scala-2.10. However, somewhere deep in the object graph Scala-2.10 throws: ! java.lang.ClassNotFoundException: scala.collection.JavaConversions$SeqWrapper ! at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_21] ! at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_21] ! at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_21] ! at java.net

Deserialize XML element with xsi:nil=“true” in C#

别说谁变了你拦得住时间么 提交于 2019-12-11 13:27:06
问题 I'm trying to deserialize a XML file with XmlSerializer in C#. The destination class that follows was automatically generated using the xsd utility. [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] [System.Xml.Serialization.XmlRootAttribute(Namespace = "",

Boost: Re-using/clearing text_iarchive for de-serializing data from Asio:receive()

别等时光非礼了梦想. 提交于 2019-12-11 13:14:55
问题 This is my current function that de-serializes data received via Boost:Asio UDP transmission. It works perfectly, however the performance is pretty bad. About 4000 or so calls per second will use ~16% of CPU, which is a full thread of an I7. Running a performance test on the code shows that this line uses >95% of the cpu time: text_iarchive LLArchive(LLStream); My question is simple: is there a way I can re-use a text_iarchive without having to create a new one each time the function is

SimpleXML: Element 'link' is already used

余生长醉 提交于 2019-12-11 12:33:40
问题 Hello and sorry for my bad English. Look at the XML I'm trying to parse: <author> <name>Name</name> <y:link href="http://api-yaru.yandex.ru/person/20623655/" rel="self"/> <y:link href="http://upics.yandex.net/20623655/normal" rel="userpic"/> </author> And SimpleXML code looks like: public class Author_feed { @Element private String name; @ElementList(inline = true) @Namespace (prefix = "y") private List<Link_feed> link; } Hovewer I see an error: Element 'link' is already used...[and points to

IExternalizable (as3)

戏子无情 提交于 2019-12-11 12:27:35
问题 has anyone used the IExternalizable interface? ... I have a fundamental question. When I haved serialized my object ... and have saved as a file .... and now I wants to make some changes in the class ... e.g. add an attribute ... I can not re-convert the file into an object of this class ... because in the readExternal method is now one more attribute, which the stored object (file) does not own .... is there a way to make this more flexible? -- // german Hallo hat schon mal jemand das im

serialization and deserialization of session data

ε祈祈猫儿з 提交于 2019-12-11 12:13:44
问题 I have stored session data in SQL server mode using asp.net.The data thus stored is serialized by asp.net.I am using a function to deserialize the data and return it in an object type.Now how will I retrieve the data? I had created a class,a serializable one,using which i am storing session data in the table. Any help regarding this will be very helpful.Thanks 回答1: You don't need to manually deserialize objects stored in ASP.NET session state. If you have session state configured like this:

(Jackson 1.9.2) Getting @JsonIgnore to work: deserialization with mixin annotations and polymorphic types

我们两清 提交于 2019-12-11 12:09:55
问题 I am trying to deserialize a JSON String like (extracted this bit to show the issue) { "$type": "com.example.StringProperty", "value": "hello world", "name": "text", "readOnly": false } into a hierarchy of classes that look like public class Property { public String name; public int type; Property(String pName, int pType) { name = pName; type = pType; } } public class StringProperty extends Property { public String value; StringProperty(String pName, String pValue) { super(pName, String);

Deserialize dynamic object name for newtonsoft property

☆樱花仙子☆ 提交于 2019-12-11 11:52:02
问题 When I am sending request for a certain API, they return me a json which is awesome, but the problem is that depending on the parameters I provide, the object name is always different while the data structure remains the same. So I am trying to convert the json to a C# class using Newtonsoft library. The only way I've found to do this is by using JsonTextReader, but I'm wondering if there is a cleaner way of achieving this, I looked up the documentation and couldn't find anything to help me

How to deserialize json string to list of objects which type I get at runtime?

孤街浪徒 提交于 2019-12-11 11:46:41
问题 I want to deserialize json string to list of objects which type I get at runtime. For example: my json string is [{"id":"1", "name":"test"},{"id":"2", "name":"test2"}] and the type I get is "Types.type1, types.dll" , so I need to deserialize it to List<type1> . If I will get the type "Types.type2, types.dll" so I need to deserialize it to List<type2> How I can do this? 回答1: You may use DataContractJsonSerializer in System.Runtime.Serialization public class Foo { public string Bar { get; set;

ServiceStack.Text.JsonSerializer.DeserializeFromString<T>() fails to deserialize if string contains \n's

混江龙づ霸主 提交于 2019-12-11 10:55:56
问题 Trying: T obj = JsonSerializer.DeserializeFromString<T>(jsonData); on a string that has several \n 's throughout it. JayRock's library successfully deserializes this like: T obj = (T)JsonConvert.Import(typeof(T), jsonData); Is this a bug, or do I need to manually strip out newlines? 回答1: The problem I ran into wasn't the \n's, but instead was the lack of public properties on my DTO's. RE: Can ServiceStack.Text deserialize JSON to a custom generic type? 回答2: The debugger preview popup shows