Questions tagged [deserialization]
Deserialization is the process by which an object is recreated from its serialized state.
8,017
questions
1
vote
3
answers
36
views
Spring deserialize a json dynamically can either be List or just an Object
I create sample class and response to deserialized but this is same issue that need to be fix. The response can either be Array with Object or just an Object.
Need to deserialized dynamically
Class
...
-2
votes
0
answers
33
views
How to serialize the RSAParameters public key and occasionally make errors?
.NET7.0,IIS10,client wpf
client:
RSAParameters publicKey, privateKey;
using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
{
publicKey = rsa.ExportParameters(false);
...
-1
votes
0
answers
28
views
Writing and Reading serialized objects from same file [duplicate]
Performing serialization and deserialization on an object by writing it in a file and reading from the file successfully. (Constraints: Need to write two or more objects and read them from the same ...
2
votes
0
answers
42
views
Rust - object-safety rules are unclear - serde dyn serialize and deserialize [duplicate]
I'm attempting to do dynamic dispatch on a trait which allows for both serialization and de-serialization.
Specifically:
// [dependencies]
// erased-serde = "0.3.31"
// serde = { version= &...
0
votes
1
answer
73
views
Deserialize xml.data in python
I have a xml file with a lot of properties. All the attrib have the same name <prop name =....
But i only want to know some of the attrib. How can i choose the ones i want?
I did have a solution ...
0
votes
1
answer
32
views
How to deserialize an object based on a text property using Newtonsoft
JsonConvert.DeserializeObject(json)
Is returning a set null objects. I've tried making the objects not descendants of Widget. Then I'm getting an error
The value "Widget2" is not of type &...
-1
votes
0
answers
41
views
XmlSerializer.Deserialize(): skip values & items with minOccurs=1
I'm trying to deserialize data stored in xml format.
Standard XSD schema implies that some elements could be skipped, specifying minOccurs=0:
<xsd:complexType name="TEAM-MEMBER" abstract=&...
0
votes
1
answer
18
views
How to map a nested XML element content as a string of a map?
I'm using Java and Jackson:
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2....
0
votes
0
answers
12
views
Deserializing LangChain messages
LangChain's BaseMessage has a function toJSON that returns a Serialized.
Once I have a list of BaseMessages, I can use toJSON to serialize them, but how can I later deserialize them?
const messages = [...
1
vote
1
answer
68
views
Why is my custom Json.net converter not working?
Since GameObjects cannot be serialized I wrote a class that holds the name of the GameObject so that it can find it by the name. However I am getting this error during deserialization and I can't ...
1
vote
1
answer
78
views
Handling Different XML Element Names for Serialization and Deserialization in C#
I need advice on handling XML serialization and deserialization in C#. My issue is that I receive XML with elements starting with uppercase letters (e.g., <Id>) for deserialization, but I need ...
3
votes
4
answers
99
views
How to deserialize a map into a vector of a custom struct, with a field matching the key?
Given a yaml with a map of items,
items:
item1:
uid: ab1234
foo: bar
item2:
uid: cd5678
foo: baz
how can I parse it with serde into a Vec<Item> with a new field, "name&...
0
votes
0
answers
31
views
Refit.ApiException at System.Text.Json.Serialization.JsonCollectionConverter
I am using Refit to call APIs in .NET 7.0
System.Text.Json.Serialization.JsonCollectionConverter throws exception when the response returned in empty.
It works fine when result contains data.
I think ...
1
vote
1
answer
55
views
Deserializing JSON file with aeson in Haskell
I'm new in Haskell. Currently I'm working on a SQL project and I got stuck on deserializing JSON file contents. I'm getting some cursed error and I don't know how to fix it.
This is my JSON file:
{
&...
0
votes
1
answer
37
views
Jackson: Is there a way to exclude everything by default in a class and include explicitly?
I have been messing about with Jackson for a while now and can't for the life of me figure out how to make Jackson only include the properties I tell it to.
We have a setup with datamodels that ...
0
votes
1
answer
28
views
Spring WebClient and JSON array with possible errors in its elements
I'm trying to fetch a JSON-array of length n and deserialize it to n objects of type RegistryPerson. This class is from an XSD and is immutable w.r.t. modification. One caveat is that the JSON-array ...
1
vote
1
answer
25
views
How to deserialize an Bson string with"id" using BsonSerializer.Deserialize()?
I am deserialize a BSON string to a C# class, and met a error.
Here is the string
{
"_typeName" : "FATPOT::Mapping::Rendering::GisSourceFile",
"compressionType"...
0
votes
1
answer
35
views
How to deserialize objects having different keys (names) but identical structure in C# .Net 8 using System.Text.Json.Serialization?
Consider following Json data below, I would like to deserialize object items in "cart" as array/Enumerable -lets say CartItem- since ojects "1345516108" and "1456460669" ...
3
votes
2
answers
54
views
How Can I Deserialize and Get the values from the ReportData Node in C#?
I have to parse an deserialize all the values from the following JSON file:
But I'm getting errors from the compiler.
[
{
"CompanyInfo": {
"Company": &...
1
vote
2
answers
101
views
Why can't I get the 'Add' and 'Clear' methode of IList from RTTI
I have an interface IList<T> (from Spring.Collections) that I want to deserialize with MVCFrameWork. It does not work, because in the code we have a function IsWrap() that looks if the methods ...
0
votes
1
answer
99
views
Is there a better way to return validation errors in ASP.NET than a 500 response when deserialization fails due to missing required fields?
To set the context:
I have a yaml oapi file
I used the OpenAPI generator to create C# classes
Some properties have [IsRequired = true] attributes
When a required property is not included on a ...
0
votes
1
answer
32
views
Deserialise TOML data into struct with nalgebra types
I have this struct -
#[derive(Deserialize)]
struct body {
label: String,
mass: f64,
pos: Point3<f64>,
vel: Vector3<f64>,
obj_col: f32,
}
And I have some data in a toml ...
0
votes
1
answer
55
views
Deserializing JSON with multiple elements of the same type with different name
I am attempting to deserialize some json into a custom object in VB.net 4.5
The Json structure can have multiple elements with different names, and the names may not be the same so I can't create a ...
0
votes
2
answers
71
views
Is there an existing Quarkus function to deserialise a CloudEvent from a JSON String?
I am currently working with Quarkus, and I encountered an issue while wanting to deserialise a JSON String message recieved through a WebSocket to a CloudEvent.
Using the Quarkus ObjectMapper doesn't ...
1
vote
1
answer
66
views
Where is the equivalent in Rust of the msgpack Timestamp class in Python
In Python, when decoding a messagepack message that contains a timestamp, the code in the msgpack library (Timestamp class) is pretty straightforward as it just takes the bytes it finds for a field ...
2
votes
1
answer
84
views
Deserialize JSON created using custom getter and unwrapped object using Jackson
This is a follow up question of an answer to Jackson custom getters.
The solution works and creates proper JSON. The problem is deserialization. I have an unwrapped object with some attributes not ...
0
votes
2
answers
41
views
Deserializing XML into POCO at runtime using inline XSD
As part of a REST response from Azure DevOps that's being deserialized into a number of classes,
one of the properties of the json response contain XML with inline schema information.
The schema isn't ...
0
votes
1
answer
62
views
fast and memory efficient way to deserialize a GUID from a byte array to a string in JavaScript
At the moment I've used this code:
getGuid(): string {
const guid = this.array[this.offset + 3].toString(16).padStart(2, '0') + this.array[this.offset + 2].toString(16).padStart(2, '0') + this....
-1
votes
2
answers
41
views
Deserializing Json String in Android Studio - Java
I am trying to deserialize a Json String using GSONbut after deserialization all values appear as Null. This is the Json String (I obtain this String from a server through a Rest API):
{"...
-1
votes
0
answers
68
views
Visual studio C# Unable to find assembly 'Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
In my VS C# solution, I have two projects, Lib and App, where Lib is a library project and App is one that will build an XLL (using ExcelDNA). In App project, I have some function that does binary ...
0
votes
0
answers
18
views
How to deserialize a JSON field with an @ and . in the name to a Typescript interface? [duplicate]
I am using Microsoft Entra ID to do single sign-on for my React app. I am following the tutorials here.
I'm able to get the reply from the Microsoft Graph API, which has the following reply:
{
&...
0
votes
0
answers
17
views
how to customize nested fields serializer through another serializer in drf
File class and Animation are related together
And I want to somehow implement the following code
serial = AnimationSerializer(instance=Animation.objects.get(id=animationn_id), fields=["duration&...
0
votes
0
answers
38
views
Use module-based serialization in another codebase where I don't control ObjectMapper construction
I maintain a Scala library that successfully uses all the automatic jackson-module-scala functionality in its own home context, where I control the construction of ObjectMappers.
Now, I'm trying to ...
-1
votes
0
answers
32
views
How to create customized (de-)serializer in Java Jackson that read/writes from multiple files?
I am trying to wrap my mind on the following: I want to use Jackson (de)serialize POJOs from multiple files - serializer would write a 'file per class'.
The object that I am trying to serialize ...
2
votes
0
answers
74
views
Kotlin - Deserializing json string with ktor
I consume a service answering object which contains a string of a json object as follow
{
"id":"13211",
"json":"{\"id\": \"5489491\", \&...
0
votes
0
answers
34
views
Receiving messages from RabbitMQ using reactive Java
I am quite a newbie to Reactive Programming in Java. I am making a project that receives messages from RabbitMQ. I use reactive RabbitMQ API -> (https://projectreactor.io/docs/rabbitmq/snapshot/...
0
votes
1
answer
41
views
C# How to deserialize JSON objects in an array to a list?
I'm new in C# and trying to retrieve all data and convert to list so I can using loop for further process. Here is the JSON data:
[
{
"TagNumber": 0001,
"TagName&...
0
votes
1
answer
29
views
C# xml deserialization: InvalidOperationException (maybe namespace related?)
I receive from another piece of code a MemoryStream object that contains an xml document and I need to deserialize it:
XML:
<?xml version="1.0" encoding="utf-8"?>
<aaa:...
0
votes
0
answers
19
views
Incrementally transfer objects
I wanted to sync an object with another object on a different computer.
The Problem: The Object is very big. It's a list with approximately 100 000 000 Entries.
I want to sync the object basically ...
0
votes
0
answers
15
views
use different namespace based on language
The flatbuffer schema file has namespace directive, which defines the namespace in the generated code. But the problem is that the style of namespace is language dependent, for example, in msg.fbs:
...
2
votes
0
answers
28
views
Is it possible to maintain backward compatibility with DynamicType in protobuf-net?
We recently made the decision to update the version of protobuf-net used in some projects.
With the update we noticed that the Dynamic Type feature was discontinued.
We would like to continue using ...
0
votes
0
answers
25
views
MongoDB Custom types FAIL to deserialize AFTER database copy
I am using a custom type in my collection, and register it on applicatin start up with:
BsonClassMap.RegisterClassMap<fw9.Core.Comms.Health.HealthReport>();
All good
However when we copy the ...
0
votes
0
answers
34
views
(PHP) Symfony Serializer Component For Array of Objects [duplicate]
Currently, I have a couple of Soap services that I interact with. Every so often, the request fails and I decided to start storing the request data, request XML, response, etc so I can fix it and ...
0
votes
1
answer
64
views
Protobuf.net How to deserialize array of int (packed data)
We are using protobuf to make several systems inter-communicate. Some of them use protobuf.net, some use other languages and libraries.
Our application-level messages consist of a header and a body.
...
0
votes
2
answers
47
views
customized JSON parser with equal sign
I'm using fasterxml java library to parse json data, some of the data is using = instead of : as the key value seperator, e.g. {"key"="foo", "size"=123}, is there a way ...
0
votes
0
answers
12
views
Json deserialize to specific Java class subtype without sending @class or @type from frontend
I'm a junior and am working on a chat app, Angular for frontend and Spring boot for Backend, and an external library called ChatServer. In my BFF i'm using the models from the ChatServer. One of those ...
0
votes
1
answer
39
views
Deserializing XML element with attributes into list of strings
I have an XML
<dependency ref="pkg:maven/org.keycloak/[email protected]?type=jar">
<dependency ref="pkg:maven/com.sun.mail/[email protected]?type=jar"/&...
0
votes
0
answers
14
views
Hessian (Java) deserialization of class which is not in the classpath does not raise an error
Is there a way to cause Hessian deserialization to throw an exception if a class is missing on the classpath?
In How does serialization tool skip unknown fields during deserialization? a comment says ...
0
votes
0
answers
25
views
GWT: Deserialize objects sent/received via websocket
I would like to analyze messages exchanged between my browser and https://metatraderweb.app. Most communication between client side and server side happens via a GWT signal server using web sockets. ...
0
votes
0
answers
70
views
Avro deserialization classload issue
My task is deserialize byte[] to POJO that was serialized with avro schema from json String.
Schema example:
"{\"type\":\"record\",\"name\":\"MKB10\",\&...