deserialization

Deserializing an empty array using Json.NET

拟墨画扇 提交于 2019-12-12 14:09:34
问题 I've got a C# application that uses Json.NET v7.0.1. As a result of a REST call, I get back some JSON in the form of: { "messages": [ {"phoneNumber":"123-456-7890", "smsText":"abcd1234="}, {"phoneNumber":"234-567-8901", "smsText":"efgh5678="}, {"phoneNumber":"345-678-9012", "smsText":"12345asdf"} ] } If there is no message data to return, the JSON that I get back looks like this: { "messages": [ ] } My Message class looks like this: public class Message { public string PhoneNumber { get; set;

Cannot deserialize datetime property Neo4j using C# client

一笑奈何 提交于 2019-12-12 13:09:41
问题 I'm trying to get strongly typed objects back out of Neo4j using the C# client. This all works until I add a DateTime property. I've successfully inserted data into the Neo4j database and I can see it using the console. I can also query the data, but I can't return any strongly typed objects because the deserialization seems to fail. I'm using parameters to insert the data: _graphClient.Cypher .WithParams(new { id = node.Id, createdAt = node.CreatedAt, lastModified = node.LastModified })

ObjectInputStream custom classloader deserialization issue: resolveClass() not called

二次信任 提交于 2019-12-12 12:26:27
问题 I have an ObjectInputStream and want to load classes with a custom ClassLoader . Thus is created a subclass of ObjectInputStream that overrides the resolveClass() function. Now my problem is that i want to change the ClassLoader during execution. But sometimes resolveClass() does not seem to be executed when I do readObject() on this stream. Then the class is loaded with the wrong ClassLoader . Any idea why resolveClass() is not executed and how to solve this issue? 回答1: resolveClass() will

Scala deserialization: class not found

点点圈 提交于 2019-12-12 10:48:17
问题 I'm trying to understand the following issue that occurs when trying to serialize/deserialize a very simple data structure: case class SimpleClass(i: Int) object SerializationDebug { def main(args: Array[String]) { val c = SimpleClass(0) val l1 = List(c) serializationSaveToFile("test", l1) val l2 = serializationLoadFromFile("test") // .asInstanceOf ... } def serializationSaveToFile(fn: String, o: Any) { val fos = new FileOutputStream(fn) val oos = new ObjectOutputStream(fos) oos.writeObject(o

Jersey serialization/deserialization issue: abstract types can only be instantiated with additional type information

淺唱寂寞╮ 提交于 2019-12-12 10:43:56
问题 I'm using jersey for both serialization and deserialization. I've made REST channel on WebLogic using jersey. I have result object with contains abstract class. Jersey adds to the result metadata with this class'es implementation name: {"order":{"@type":"installationOrder", However, the same jersey, when using to deserialize this data, is screaming the following: Caused by: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of ocl.mobile.service.data.order.DetailedOrder

gemfire custom serialization not helping

夙愿已清 提交于 2019-12-12 10:16:16
问题 I am using gemfire as my cache. The cache heap size is well above 100GB. I discovered that when we put data in gemfire cache from client, it would serialize the data and send to server, and on server the data is stored in serialized form. Problems: When i try to execute any on-server function call, it then starts deserializing the data and it is really time consuming, some times it takes more than an hour just to iterate through the objects in cache. (Number of objects are close to 6 million)

deserialize json array list in c#

亡梦爱人 提交于 2019-12-12 09:56:30
问题 I'm working on a project which has as backend mainly C#, but I'm not an experienced C# dev so I'm not able to figure out hot to fix a json deserialization of an list of objects. The following function is what takes care of the deserialization, but I get an error : using System.IO; using System.Web; using Raven.Imports.Newtonsoft.Json; namespace Corina.Web.Handlers { public class JsonRequestHandler { public T Handle<T>(HttpContextBase context) { string requestData; context.Request.InputStream

Jackson: is it possible to include property of parent object into nested object?

江枫思渺然 提交于 2019-12-12 09:53:27
问题 I'm using Jackson to serialize/deserialize JSON objects. I have the following JSON for a Study object: { "studyId": 324, "patientId": 12, "patient": { "name": "John", "lastName": "Doe" } } UPDATE: Unfortunately the JSON structure cannot be modified. It's part of the problem. I would like to deserialize the object to the following classes: public class Study { Integer studyId; Patient patient; } and public class Patient { Integer patientId; String name; String lastName; } Is it possible to

Deserializing JSON with nested arrays in C#

耗尽温柔 提交于 2019-12-12 08:54:26
问题 I'm having trouble trying to deserialize this JSON here: { "response": { "numfound": 1, "start": 0, "docs": [ { "enID": "9999", "startDate": "2013-09-25", "bName": "XXX", "pName": "YYY", "UName": [ "ZZZ" ], "agent": [ "BobVilla" ] } ] } } The classes I created for this are: public class ResponseRoot { public Response response; } public class Response { public int numfound { get; set; } public int start { get; set; } public Docs[] docs; } public class Docs { public string enID { get; set; }

Jackson desrialize when JsonProperty is sometimes array and sometimes a single Object

你离开我真会死。 提交于 2019-12-12 08:34:33
问题 I've searched Stack Overflow before posting, but there were no solutions for Jackson. Here is a server response: { "ok": true, "result": [ { "update_id": 489881731, //rest }, { "update_id": 489881732, //rest } ] } As you see property "result" is an array. Now this is another response: { "ok": true, "result": { "id": 211948704, "first_name": "ربات ادمین‌های تلگرام", "username": "tgAdminsBot" } } Here "result" is a single object. This is my class I want to deserialize content to it. I wrote a