serialization

Cereal serialization error

拈花ヽ惹草 提交于 2020-08-06 21:25:47
问题 So i'm legit confused. It won't compile for an external serialization function. It gives the error cereal could not find any output serialization functions for the provided type and archive combination. So the code below doesn't compile #include <fstream> #include <glm/glm.hpp> #include "SceneObject.h" #include <cereal/cereal.hpp> #include <cereal/archives/json.hpp> template<typename Archive> void serialize(Archive& archive, glm::vec3& v3) { archive(cereal::make_nvp("x", v3.x), cereal::make

Cereal serialization error

穿精又带淫゛_ 提交于 2020-08-06 21:22:50
问题 So i'm legit confused. It won't compile for an external serialization function. It gives the error cereal could not find any output serialization functions for the provided type and archive combination. So the code below doesn't compile #include <fstream> #include <glm/glm.hpp> #include "SceneObject.h" #include <cereal/cereal.hpp> #include <cereal/archives/json.hpp> template<typename Archive> void serialize(Archive& archive, glm::vec3& v3) { archive(cereal::make_nvp("x", v3.x), cereal::make

Pickle alternatives

断了今生、忘了曾经 提交于 2020-07-31 18:33:37
问题 I am trying to serialize a large (~10**6 rows, each with ~20 values) list, to be used later by myself (so pickle's lack of safety isn't a concern). Each row of the list is a tuple of values, derived from some SQL database. So far, I have seen datetime.datetime , strings, integers, and NoneType, but I might eventually have to support additional data types. For serialization, I've considered pickle (cPickle), json, and plain text - but only pickle saves the type information: json can't

Pickle alternatives

只谈情不闲聊 提交于 2020-07-31 18:23:58
问题 I am trying to serialize a large (~10**6 rows, each with ~20 values) list, to be used later by myself (so pickle's lack of safety isn't a concern). Each row of the list is a tuple of values, derived from some SQL database. So far, I have seen datetime.datetime , strings, integers, and NoneType, but I might eventually have to support additional data types. For serialization, I've considered pickle (cPickle), json, and plain text - but only pickle saves the type information: json can't

How to log Protobuf string in nested objects in a human-readable way?

不打扰是莪最后的温柔 提交于 2020-07-30 17:24:55
问题 Given a proto file: syntax = "proto3"; package hello; message TopGreeting { NestedGreeting greeting = 1; } message NestedGreeting { Greeting greeting = 1; } message Greeting { string message = 1; } and the code: public class Main { public static void main(String[] args) { System.out.printf("From top: %s%n", newGreeting("오늘은 무슨 요일입니까?")); System.out.printf("Directly: %s%n", "오늘은 무슨 요일입니까?"); System.out.printf("ByteString: %s", newGreeting("오늘은 무슨 요일입니까?").toByteString().toStringUtf8()); }

How to log Protobuf string in nested objects in a human-readable way?

荒凉一梦 提交于 2020-07-30 17:23:36
问题 Given a proto file: syntax = "proto3"; package hello; message TopGreeting { NestedGreeting greeting = 1; } message NestedGreeting { Greeting greeting = 1; } message Greeting { string message = 1; } and the code: public class Main { public static void main(String[] args) { System.out.printf("From top: %s%n", newGreeting("오늘은 무슨 요일입니까?")); System.out.printf("Directly: %s%n", "오늘은 무슨 요일입니까?"); System.out.printf("ByteString: %s", newGreeting("오늘은 무슨 요일입니까?").toByteString().toStringUtf8()); }

How to customize dictionary serialization with DataContractSerializer?

狂风中的少年 提交于 2020-07-22 22:11:17
问题 Dictionary serialization with DataContractSerializer generate below data. How to replace d2p1:KeyValueOfintint , d2p1:Key and d2p1:Value with our own attributes / tags / identifier. Serializing Dictionary in [CashCounter], Output Generate after Serialization given below <CashCounter xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/DictionarySerlization"> <BankNote xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1

Size of Serialized data is not reducing using flatbuffer

喜你入骨 提交于 2020-07-22 21:16:32
问题 I have written following fbs file namespace testing; table polygon { x : double; y : double; } table layer { layer_name : string; polygons : [polygon]; } root_type layer; My plan is to serialize approx 5 Million coordinates and dump it into one file. Problem is what I see is the number of bytes is increased compared to what I was expecting. I am expecting it should be arounf (5M* 16) bytes. But the size what I am getting is 140000032 bytes Here is the java code which I am using for dumping

Python 3.5 dill pickling/unpickling on different servers: “KeyError: 'ClassType'”

浪尽此生 提交于 2020-07-20 08:30:09
问题 See updates at the bottom -- A similar question was asked here, but never resolved: pickling and unpickling user-defined class I'm working on a project which necessitates pickling user defined classes, and sending them to a remote server where they are unpickled and called. We use the Dill library to accomplish this, and have had a lot of success. Unfortunately, I've run into an issue I'm having a hard time debugging. I create and pickle a class as follows: import dill, base64 import time,

Can Json.NET deserialize a flattened JSON string with dot notation?

China☆狼群 提交于 2020-07-18 04:14:45
问题 I have a flattened JSON: { "CaseName" : "John Doe v. State", "CaseDate" : "<some date>", "Client.FirstName" : "John", "Client.LastName" : "Doe", "Client.Email" : "johndoe@gmail.com" etc... } I want to deserialize it back to this entity: public class Case() { public string CaseName { get; set; } public string CaseDate { get; set; } public Client Client { get; set; } } where Client.FirstName , Client.LastName , and Client.Email are properties in the Client object. Using Json.NET, is there any