deserialization

Serialize with Qt, deserialize without Qt?

送分小仙女□ 提交于 2019-12-11 18:24:52
问题 If I serialize a struct using QDataStream and send this via UDP, is it possible to then deserialize it without Qt ? 回答1: if you want to deserialize without using the Qt library, you would have to read the Qt serialization format which is described briefly here, and write the deserialization code yourself. And since this format is likely to change, you should use setVersion in the serializing application and stick into some version that you can implement deserialization code for it in the

How to parse this JSON string into 2 List<String>

回眸只為那壹抹淺笑 提交于 2019-12-11 17:19:18
问题 I have some problem to understand how you parse this JSON string. As seen we have 2 lists in the JSON string. "bids" and "asks" For bids for example we have: 0.035314,25.986 0.035313,6.947 etc The goals is to create 2 lists, bids and asks where each element in the list contains the above. For example each index contains this information then: "0.035314,25.986" etc. How will one approach this string when doing this? Expected output should be as an understanding like below: List<String>

Deserializing JSON with dynamic keys

浪子不回头ぞ 提交于 2019-12-11 17:11:33
问题 I'm quite new to JSON, and am currently learning about (de)serialization. I'm retrieving a JSON string from a webpage and trying to deserialize it into an object. Problem is, the root json key is static, but the underlying keys are dynamic and I cannot anticipate them to deserialize. Here is a mini example of the string : {"daily":{"1337990400000":443447,"1338076800000":444693,"1338163200000":452282,"1338249600000":462189,"1338336000000":466626} For another JSON string in my application, I

deserialization from an abstract base fails for boost serialization

≡放荡痞女 提交于 2019-12-11 17:07:29
问题 I'm able to serialize an object through an abstract base using boost::serialization. However, when I try to add deserialization, I get compile errors about the abstract base. Here's my serialization code that works: /* g++ -Iinclude/ -Llib -lboost_serialization ~/Desktop/ser_ex.cpp -o stest */ #include <boost/serialization/serialization.hpp> #include <boost/serialization/nvp.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/serialization/vector.hpp> #include <iostream>

Jackson deserialization/serialization does not sort properties

Deadly 提交于 2019-12-11 16:58:54
问题 I'm using Jackson 2.8.9 in my application to generate some JSON. I have some unit tests in which I compare generated JSON with some files content. When I compare my generated JSON with my file content, it does not match due to the properties order. For the tests to be repeatable I need to have the properties sorted alphabetically. But with Jackson, it does not seems to work. I wrote some tests for illustation. Only should_indent_properties pass. public class FormatJsonWithJacksonTest {

Serialization list of different object

情到浓时终转凉″ 提交于 2019-12-11 16:38:34
问题 Hi everyone I need help I can't figure how to serialize /deserialize, and I tried lots of things that i saw on stack overflow and nothing worked. The situation is here, I have a zoo class that create a list using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Xml.Serialization; namespace TP3 { class Zoo { private List<object> zooList; public Zoo() { zooList = new List<object>(); } public void add (

How do I deserialize a JSON array without needing a wrapper type? [duplicate]

别来无恙 提交于 2019-12-11 15:11:56
问题 This question already has an answer here : How can I deserialize JSON with a top-level array using Serde? (1 answer) Closed last year . I want to deserialize the following JSON: [ { "name": "one", "path": "/path/to/one" }, { "name": "two", "path": "/path/to/two" }, { "name": "three", "path": "/path/to/three" } ] Into a Vec<Worskpace> . Workspace is defined below: #[derive(Serialize, Deserialize)] struct Workspace { name: String, path: String, } Is there a way to do that without having to do

Java Kafka Object serilizer and deserializer

梦想的初衷 提交于 2019-12-11 15:08:32
问题 I am doing kafka producers and consumers. there are three ways to do Serialization and de-serialization. 1, custom object -> byte[] -> object (example) 2, custom object -> String -> object (I tried. working) 3, custom object -> JsonNode -> object (example) Which one is better? Thanks 回答1: You can try benchmarking but I would imagine all three are about the same. Object -> byte[] : In this case three things are happening. Object is converted into a tree of Json objects. Tree is converted to a

encoding xml for deserialization in c#

99封情书 提交于 2019-12-11 15:05:59
问题 I have several xml files which I want do deserialize. var serializer = new XmlSerializer(typeof(Document)); var encoding = Encoding.GetEncoding("Windows-1252"); var sr = new StreamReader(current_file, encoding, true); var reader = XmlReader.Create(sr); var i = (Document)serializer.Deserialize(reader); The problem is that the files have got different encodings. "Windows-1252" and "iso-8859-1". How can I deal with both of them? 回答1: I guess this answer obtaining the xml encoding will be helpful

Metro Style App: JSON Object Deserialization Error, REST Services

大憨熊 提交于 2019-12-11 14:08:30
问题 Element ':item' contains data from a type that maps to the name "http://schemas.microsoft.com/search/local/ws/rest/v1:Route.' The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'Route' to the list of known types - for example, by using KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer. After adding [DataContract(Namespace = "http://schemas.microsoft