serialization

Which Json deserializer renders IList<T> collections?

蹲街弑〆低调 提交于 2020-01-12 04:06:12
问题 I'm trying to deserialize json to an object model where the collections are represented as IList<T> types. The actual deserializing is here: JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Deserialize<IList<Contact>>( (new StreamReader(General.GetEmbeddedFile("Contacts.json")).ReadToEnd())); Before i post the exception i'm getting you should know what the implicit conversions are. This is the Contact type: public class Contact { public int ID { get; set; }

What's wrong with this deserialization from a JSON file to objects using Gson?

那年仲夏 提交于 2020-01-11 14:38:07
问题 So I have the following super class: public class Location { private String name; private double[] coordinates; private String description; } And the following subclasses: public class Monument extends Location { private String architect; private short inauguration; } public class Restaurant extends Location { private String[] characteristics; } public class Hotel extends Location { private short stars; } The JSON file I'm trying to deserialize is an array of Locations where each location can

NotSerializableException on serialization of objects currently shown by Vaadin

僤鯓⒐⒋嵵緔 提交于 2020-01-11 14:16:46
问题 I get a NotSerializableException when I want to serialize an Object that is currently shown by Vaadin. The structure is like this: Vaadin UI <--- serialize / deserialize --- > Hibernate/JPA Postgres Database Vaadin shows objects that are requested from the Database via IPC, but when I manipulate the object and want to save it again by serializing it and sending it over to the controller I get the following Exception: java.io.NotSerializableException: org.springframework.boot.context.embedded

Serialized data in mysql database needs to combined in an array

笑着哭i 提交于 2020-01-11 13:35:28
问题 I am working in PHP/MySQL. I have a table in my database called hourly in that table their is a column named webaddress these are serialized. There are multiple rows of each column of webaddresses each is serialized. I need to pull each row, unserailize them then put them into an array. I tried using this bit of code but it only grabs 1 row because of the limitations of the PHP functions. while ($row = mysql_fetch_array($results)) {$test = unserialize($row[0]);} I was thinking something like

Serialized data in mysql database needs to combined in an array

余生长醉 提交于 2020-01-11 13:35:06
问题 I am working in PHP/MySQL. I have a table in my database called hourly in that table their is a column named webaddress these are serialized. There are multiple rows of each column of webaddresses each is serialized. I need to pull each row, unserailize them then put them into an array. I tried using this bit of code but it only grabs 1 row because of the limitations of the PHP functions. while ($row = mysql_fetch_array($results)) {$test = unserialize($row[0]);} I was thinking something like

C# Deserialize Root JSON Unknown Keys

故事扮演 提交于 2020-01-11 13:07:34
问题 I have a JSON like this and have to deserialize it: { "0": { "foo_id":"xyz", "bar_id":"abc", "book": { "0": { "title":"hello", "author":"person_x" }, "1": { "title":"hi", "author":"person_y" } }, "1": { "foo_id":"xyz", "bar_id":"abc", "book": { "0": { "title":"hello", "author":"person_a" }, "1": { "title":"bye", "author":"person_b" } }, "random":"string", "other":"thing" } Similar to this question, except the answer given doesn't work, because I don't have the luxury of creating a class like

Is there any equivalent to writeReplace in CORBA?

眉间皱痕 提交于 2020-01-11 11:56:49
问题 When using standard Java serialization, it is possible to have an object replaced on the fly in stream by, according to Serializable interface, creating a Object writeReplace() method that will be invoked during serialization. My question is simple : is there an equivalent for this construct in Corba Java implementation ? 回答1: You can use writeReplace as normal with RMI-IIOP (Java RMI over CORBA/IIOP). The ORB presents "standard" Java serialization of Serializable/Externalizable (with all

Easy way to write and read some Transform to a text file in Unity3d?

人盡茶涼 提交于 2020-01-11 11:19:12
问题 This is strictly in Unity3D, I have an array of 100 Transform , I want to write those to a file on the PC desktop, and later read them. Consider ... // write to desktop... string s = ""; for ( int i=0; i< sendMe.Length; ++i ) { Transform tt = sendMe[i].transform; s = s +tt.position.x +"," +tt.position.x +"," ...etc... "\n"; } string d = System.Environment.GetFolderPath( System.Environment.SpecialFolder.DesktopDirectory); string path = System.IO.Path.Combine(d, "happyData.txt" ); System.IO

Cannot serialize a generic type 'System.Windows.FreezableCollection`

[亡魂溺海] 提交于 2020-01-11 11:17:07
问题 Hopefully a simple question. I have a custom control with a dependency property that contains a list of another custom control. public static readonly DependencyProperty BlockObjectsProperty = DependencyProperty.Register("BlockObjects", typeof(FreezableCollection<BlockObject>), typeof(Block), new FrameworkPropertyMetadata(new FreezableCollection<BlockObject>(), null)); public FreezableCollection<BlockObject> BlockObjects { get { return (FreezableCollection<BlockObject>)base.GetValue

Set accessor not being called when I deserialise object from Json.net

最后都变了- 提交于 2020-01-11 10:29:32
问题 public class SpecialObject { public string ID; [JsonIgnore] public List<SpecialObject> SpecialObjectCollection = new List<SpecialObject>(); [JsonIgnore] public List<string> tempObjectIDs = new List<string>(); [JsonProperty] public List<string> SpecialObjectIDs { get { return SpecialObjectCollection.Select(x => x.ID).ToList(); } set { tempObjectIDs = value; } } public SpecialObject() { } public SpecialObject(string _id) { ID = _id; } } static void Main(string[] args) { SpecialObject parent =