serialization Questions

2

Solved

hope someone can help me, I've been searching, and haven't been able to find a solution. Might as well be something basic, I just can't find a solution. services.AddMvc().SetCompatibilityVersion(Co...
Euterpe asked 19/3, 2020 at 19:2

45

Solved

How to make a Python class serializable? class FileItem: def __init__(self, fname): self.fname = fname Attempt to serialize to JSON: >>> import json >>> x = FileItem('/foo/bar'...
Bundy asked 22/9, 2010 at 11:52

4

Solved

I've noticed that if I have some variables exposed to the Unity inspector such as: [SerializeField] GameObject _tickIcon; If I leave them unassigned and try to use the null conditional operator an...
Hyperemia asked 1/7, 2020 at 13:41

6

I want to replace the String "com.oldpackage.className" with "com.newPackage.className" in a stream of serialized data. This serialized data is read from the DB and updated after replacing the stri...
Ronrona asked 12/1, 2011 at 12:16

10

Solved

If i have a nested serializer: class ChildSerializer(ModelSerializer): class Meta: fields = ('c_name', ) model = Child class ParentSerializer(ModelSerializer): child = ChildSerializer(many=...
Dianoetic asked 31/5, 2015 at 17:33

11

Solved

How do I save a trained model in PyTorch? I have read that: torch.save()/torch.load() is for saving/loading a serializable object. model.state_dict()/model.load_state_dict() is for saving/loading ...
Rothberg asked 9/3, 2017 at 19:6

1

I'm in the process of upgrading a Pydantic v1 codebase to Pydantic V2. Pydantic has a variety of methods to create custom serialization logic for arbitrary python objects (that is, instances of cla...
Regulable asked 28/9, 2023 at 16:7

6

Solved

I have a serializer in Django REST framework defined as follows: class QuestionSerializer(serializers.Serializer): id = serializers.CharField() question_text = QuestionTextSerializer() topic = ...

5

Solved

I'm serializing my objects with ObjectOutputStream(FileOutputStream(File)) and deserializing them with the analogous InputStreams. Is there a way to look inside of these serialized files (in eclips...
Commeasure asked 3/2, 2011 at 17:55

2

DjangoRestFramework seems to handle errors with a variety of ways. The ValidationError in the serializer class does not consistently return JSON the same. Current response includes a JSON list/obj...

3

Solved

I'm trying to do a one way transform from F#'s discriminated union to strings upon serialization instead of the default `"Case": [value]". Being able to deserialize the value again is not an issue....
Stagestruck asked 12/11, 2017 at 9:31

13

Solved

I'd like to read multiple JSON objects from a file/stream in Python, one at a time. Unfortunately json.load() just .read()s until end-of-file; there doesn't seem to be any way to use it to read a s...
Priory asked 30/7, 2011 at 22:12

3

I have a JsonConverter that, depending on an instance specific flag, needs to either run custom serialization logic run the default Json.NET serialization logic How can the default Json.NET ser...
Durer asked 26/1, 2014 at 16:51

5

Solved

I read the msgpack-cli quick start documentation. I also got the C# (CLI) NuGet package (v0.3). None of the classes (eg BoxingPacker, CompiledPacker or ObjectPacker) mentioned in the official doc...
Illdefined asked 6/4, 2013 at 2:29

6

Solved

I have a class which has not default constructor. And I need a way to get 'blank' instance of this class. 'blank' means that after instantiation all class fields should has default values like null...

15

Solved

How do I serialize an object into query-string format? I can't seem to find an answer on google. Thanks. Here is the object I will serialize as an example. public class EditListItemActionModel { ...
Denary asked 27/7, 2011 at 17:0

2

I have preprocessed data in .npy files, let's call it X.npy for raw data and Y.npy for labels. They're organized to match every element from both files (first element from X has first label from Y ...
Chopper asked 18/9, 2019 at 9:41

4

Solved

I am trying to figure out how to append two more values to the serialize method in JQuery. I have the following code to submit a form with ajax and have two more variables that I would like to appe...
Portly asked 27/11, 2011 at 21:48

2

import kotlinx.serialization.Serializable @Serializable sealed class Exercise(open val id: String) { @Serializable data class Theory(override val id: String) : Exercise(id) } I have such kind ...
Hypomania asked 30/7, 2020 at 12:22

2

I supposed that I had a parent Class Parameter that has 2 sub classes ComboParameter and IntegerParameter @JsonSubTypes({ @JsonSubTypes.Type(value = IntegerParameter.class, name = "integerParam")...
Mcgannon asked 11/3, 2015 at 17:11

7

Solved

I get an xml from the 3rd party and I need to deserialize it into C# object. This xml may contain attributes with value of integer type or empty value: attr=”11” or attr=””. I want to deserialize t...
Grethel asked 18/8, 2009 at 18:35

8

Im having issues to get the desired output for my json file with the build_runner it runs successfully but isn't giving any outputs my first.dart file ``` import 'package:json_annotation/json_annot...
Nunez asked 17/12, 2021 at 6:58

2

Solved

Take the following DTO classes: class UserDTO { /** * @param AddressDTO[] $addressBook */ public function __construct( public string $name, public int $age, public ?AddressDTO $billingAddres...
Tamis asked 23/12, 2021 at 22:29

8

Solved

I am trying to deserialize a stream but I always get this error "End of Stream encountered before parsing was completed"? Here is the code: //Some code here BinaryFormatter b = new BinaryFormat...
Pulvinate asked 20/11, 2008 at 19:48

13

Solved

Let's say I have a serializable class AppMessage. I would like to transmit it as byte[] over sockets to another machine where it is rebuilt from the bytes received. How could I achieve this?
Gabriellia asked 14/5, 2010 at 18:31

© 2022 - 2024 — McMap. All rights reserved.