serialization

Deserialization of reference types without parameterless constructor is not supported

浪子不回头ぞ 提交于 2020-05-13 06:57:06
问题 I have this API public ActionResult AddDocument([FromBody]AddDocumentRequestModel documentRequestModel) { AddDocumentStatus documentState = _documentService.AddDocument(documentRequestModel, DocumentType.OutgoingPosShipment); if (documentState.IsSuccess) return Ok(); return BadRequest(); } And this is my request model public class AddDocumentRequestModel { public AddDocumentRequestModel(int partnerId, List<ProductRequestModel> products) { PartnerId = partnerId; Products = products; } [Range(1

Deserialization of reference types without parameterless constructor is not supported

旧巷老猫 提交于 2020-05-13 06:56:06
问题 I have this API public ActionResult AddDocument([FromBody]AddDocumentRequestModel documentRequestModel) { AddDocumentStatus documentState = _documentService.AddDocument(documentRequestModel, DocumentType.OutgoingPosShipment); if (documentState.IsSuccess) return Ok(); return BadRequest(); } And this is my request model public class AddDocumentRequestModel { public AddDocumentRequestModel(int partnerId, List<ProductRequestModel> products) { PartnerId = partnerId; Products = products; } [Range(1

Understanding Spark's closures and their serialization

天涯浪子 提交于 2020-05-10 07:15:25
问题 Disclaimer: just starting to play with Spark. I'm having troubles understanding the famous "Task not serializable" exception but my question is a little different from those I see on SO (or so I think). I have a tiny custom RDD ( TestRDD ). It has a field which stores objects whose class does not implement Serializable ( NonSerializable ). I've set the "spark.serializer" config option to use Kryo. However, when I try count() on my RDD, I get the following: Caused by: java.io

How to elegantly serialize and deserialize OpenCV YAML calibration data in Java?

不羁岁月 提交于 2020-05-09 05:43:11
问题 I'm trying to load / save OpenCV calibration data in YAML format using the official OpenCV Java bindings. I am aware OpenCV (c++ version at least) can serialize to XML and JSON but I would like to support older YAML calibration files. A calibration file looks like this: %YAML:1.0 cameraMatrix: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 6.6278599887122368e+02, 0., 3.1244256016006659e+02, 0., 6.6129276875199082e+02, 2.2747179767124251e+02, 0., 0., 1. ] imageSize_width: 640 imageSize_height:

How can I return FlightOfferSearch and FlightOrder objects as JSON?

≡放荡痞女 提交于 2020-04-30 09:21:07
问题 If I try to return FlightOfferSearch[] or FlightOrder objects from a handler method of my Spring Boot REST Controller, they don't seem to get serialized correctly like simpler POJOs I've worked with before where Jackson handled JSON serialization. My code (actual API calls mostly identical to the SDK github example): import com.amadeus.Amadeus; import com.amadeus.Params; import com.amadeus.exceptions.ResponseException; import com.amadeus.resources.FlightOfferSearch; import com.amadeus

C# NewtonSoft DeserializeObject error

蓝咒 提交于 2020-04-30 06:54:27
问题 The strange thing is that it works fine on my local deploy (Win 10 IIS) but when I deploy it to our UAT server, it goes nuts. I'm trying to deserialize the following json string: { "header": { "application-code": "ZZZ" }, "piece": [ "0000001" ] } The classes that represent this are defined: public class RequestPiece { [JsonProperty(PropertyName = "header")] public RequestHeaderPiece requestheader { get; set; } } public class ResponseHeaderPiece { [JsonProperty(PropertyName = "application-code

Does PowerShell support HashTable Serialization?

无人久伴 提交于 2020-04-27 04:45:06
问题 If I want to write an object / HashTable to disk and load it up again later does PowerShell support that? 回答1: Sure, you can use PowerShell's native CliXml format: @{ a = 1 b = [pscustomobject]@{ prop = "value" } } | Export-Clixml -Path hashtable.ps1xml Deserialize with Import-CliXml: PS C:\> $ht = Import-CliXml hashtable.ps1xml PS C:\> $ht['b'].prop -eq 'value' True 回答2: The answer may depend on the data in your hashtable. For relatively simple data Export-Clixml and Import-CliXml is the

Python object serialization: having issue with pickle vs hickle

 ̄綄美尐妖づ 提交于 2020-04-17 22:44:19
问题 For couple of days now, I am stuck on my machine learning project. I have a python script that should transform the data for model training by a second script. In the first script is a list of arrays that I would like to dump to the disk, the second unpickle it. I tried using pickle several times, but every time the script attempts pickling, I get memory error: Traceback (most recent call last): File "Prepare_Input.py", line 354, in <module> pickle.dump(Total_Velocity_Change, file)

Python object serialization: having issue with pickle vs hickle

谁说我不能喝 提交于 2020-04-17 22:41:44
问题 For couple of days now, I am stuck on my machine learning project. I have a python script that should transform the data for model training by a second script. In the first script is a list of arrays that I would like to dump to the disk, the second unpickle it. I tried using pickle several times, but every time the script attempts pickling, I get memory error: Traceback (most recent call last): File "Prepare_Input.py", line 354, in <module> pickle.dump(Total_Velocity_Change, file)

Call default JsonSerializer in a JsonConverter for certain value type arrays

a 夏天 提交于 2020-04-16 12:58:33
问题 I'm trying to achieve roughly what's described here: Recursively call JsonSerializer in a JsonConverter In short; To examine a value being deserialised, then either consume it in my own code, or hand it off the the default deserializer. The example uses a nifty trick to avoid the same custom code being called recursively: ... else if (reader.TokenType == JsonToken.StartObject) // Use DummyDictionary to fool JsonSerializer into not using this converter recursively dictionary = serializer