Questions tagged [deserialization]

Deserialization is the process by which an object is recreated from its serialized state.

7954 questions
2
votes
1 answer

How to return an error from `deserialize`?

When implementing Deserialize, how to return an error? impl<'de> Deserialize<'de> for Response { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de> { ... // Which error to return here? } } Here…
porton
  • 5,214
  • 11
  • 47
  • 95
2
votes
1 answer

C# Deserialize XML file to List

I want to deserialize XML into a list of objects. This are my top level C# classes: [XmlRoot("Events")] [XmlType("Events")] [Serializable] public class WinEventLogList { public WinEventLogList() { Items = new List(); } …
sebsmgzz
  • 361
  • 2
  • 11
2
votes
1 answer

Deserialising problem with lombok builder and jackson, cannot construct instance of [...] no String-argument constructor/factory method to deserialize

This is a simplified version of a problem I've been having. Given these classes: @Value @Jacksonized @Builder(builderClassName = "Builder", setterPrefix = "with") public class Limits { Limit minimum; Limit…
2
votes
2 answers

C# XML deserialize self closing raw element

I need to process some XML input which has HTML code in some tags. For these tags I want the raw content to process it later. I followed this answer and used XmlElement which works fine in most cases. The only problem I'm facing are self closing…
Janis E.
  • 31
  • 4
2
votes
2 answers

How do you deserialize a string with an enum where any other value deserializes into a newtype variant while preserving the string?

I have an enum similar to the following: #[derive(Deserialize)] enum ExampleEnum { #[serde(rename = "variant1-rename")] Variant1, #[serde(rename = "variant2-rename")] Variant2, Other(String), } It should deserialize like…
2
votes
1 answer

Serialize/de-serialize java duration to JSON with custom hh:mm format with Jackson

Description I'm new to Java AND Jackson and I try to save a java.time.duration to a JSON in a nice and readable hh:mm (hours:minutes) format for storing and retrieving. In my project I use: Jackson…
2
votes
2 answers

How to deserialize java.time.Instant in Jackson2JsonRedisSerializer

I am using Jackson2JsonRedisSerializer. @Bean public RedisOperations redisOperations(RedisConnectionFactory factory){ Jackson2JsonRedisSerializer serializer = new…
2
votes
2 answers

C# JsonSerializer.Deserialize fails if property has null value despite JsonIgnoreCondition.WhenWritingNull

From an external webservice i receive either // jsonWithConfig // property config is an object {} {"config":{"c1":"All","c2":"is peachy"},"message":"We found a config object"} // jsonNoConfig // property config is string with the value…
surfmuggle
  • 5,527
  • 7
  • 48
  • 77
2
votes
1 answer

How to convert a Neural Network model to a standalone function source code

I have to run source code in an environment where I do not have access to third-party libraries and I would like to be able to use a Neural Network model for predictions in that environment. I cannot run compiled code, it has to be source code. I'd…
2
votes
3 answers

Json Jackson won't unwrap root element

I've been trying to deserialize an array of JSON objects for a while now, and all the answers on the internet are either deprecated or just don't work for me. The code below always returns a MismatchedInputException with the following…
2
votes
1 answer

Why the .Net JsonConvert.DeserializeObject can't set private properties but JsonConvert.PopulateObject can?

so in order to use private setters with Json.Net, the [JsonProperty] attribute had to be used, however, it seems that private setters don't cause any issue if we use JsonConvert.PopulateObject, Example: If we have Class A that will be…
alaslipknot
  • 551
  • 4
  • 8
  • 24
2
votes
2 answers

When I deserialize a class in java, how can I deserialize so that that any parent object properties of the class are deserialized as child only?

I am working with the following structure: class Family { //... Parent parent; } class Parent { //... } class ChildA extends Parent { //... } class ChildB extends Parent { //... } I am trying to deserialize a JSON object…
jgialis
  • 71
  • 1
  • 6
2
votes
1 answer

Derived classes' properties not getting value

Say one has an abstract Car class with a derived Cabrio class. From a REST api he recieves a JSON with data abstract class Car { int id; String name; String description; Car({ this.id, this.name, this.description, }); …
MwBakker
  • 498
  • 5
  • 18
2
votes
1 answer

How to Deserialize the current class

I do not know if this is even possible but let's suppose I have a class: [Serializable] public class Test { //Properties and functions would go here. public void SaveClass(string FilePath) { …
Jonathan Barraone
  • 489
  • 1
  • 3
  • 20
2
votes
0 answers

XMLDeserialize, "There was an error reflecting type"

Possible Duplicate: XmlSerializer - There was an error reflecting type XmlSerializer ser = new XmlSerializer(typeof(configType)); There was an error reflecting type 'MyNameSpace.configType'. I'll pare away at configType some more in the hope…
John
  • 6,433
  • 7
  • 47
  • 82
1 2 3
99
100