Questions tagged [json-serialization]

302 questions
1
vote
0 answers

How to pass db:Session object to celery task in fastapi

This is the route from where I am calling the the celery task in fastapi project @router.get("/") def read_bhav( db: Session = Depends(deps.get_db), skip: int = 0, limit: int = 100, current_user: models.User =…
1
vote
2 answers

Java Gson JSON: Serializing an Object which contains a List>

I am currently trying serialze and correctly deserialize an Object containing a List with tuples using googles Gson. I have found similar questions here here and here but I wasnt able to adjust their solutions to my problem, because my List is in an…
1
vote
1 answer

jackson - avoid serializing getters

I have a class that has some additional getters for derived values. When I serialize this with jackson objectmapper, it writes out that field as well. Is there a way to avoid that? example - public class CustomPath implements Serializable { private…
nit
  • 85
  • 1
  • 5
1
vote
1 answer

Serialization of Dynamic JSON using ProtoBuf - Java

Need some insights: How to write proto file for serializing a java POJO class containing JSONObject as attribute with Protobuf serialization. The JSON we have is fluid (keys keep changing). Sample: public class POJO { private String atr1; private…
1
vote
0 answers

Jackson with JsonTypeInfo - Serialize Map with nested maps as values

In Java, I need to serialize an object that is wrapper for Map. I would like to have a JsonTypeInfo for map values included in generated Json. I have a problem when I put as value another map like Map. The…
Kristoff
  • 326
  • 2
  • 13
1
vote
0 answers

Is there a way to serialize a json response (from a .net API) to replace $ref objects in the list with the complete object in dart?

I have an API that returns a response similar to the one shown in this post. My response comes back with objects in the list only containing a $ref variable that is pointing to a child object somewhere in the list with a relating $id. I tried the…
1
vote
1 answer

JSON stringify skip nested object which has more than 3 levels

I wanted to store the object in local storage and I serialized the object using JSON.stringify. Then some of the inner attributes are missing after parse using JSON.parse. I attached 2 images below to see the changes and appreciate it if anyone can…
1
vote
1 answer

"JsonException: The JSON value could not be converted to NodaTime.Instant" NodaTime issue with ASP.NET Core 3.1 Razor Page web application

In ASP.NET Core 3.1 Razor Page pure front end web application I received the below error. Installed the following packages:
1
vote
1 answer

Realm Swift object duplicates on every JSON serialization

When my app is first downloaded, it takes a JSON file and serialized it into a Realm database. This was the only way I found that would allow me to pre-populate a realm database and at the same time make it writable. Since Realm doesn't accept lists…
enigrify
  • 281
  • 3
  • 17
1
vote
2 answers

NoClassDefFoundError kotlinx serialization

I have a kotlin multiplatform project and I need to serialize a class. I have included the following dependency in my commonMain and androidMain and iosMain respectively in my multiplatform gradle file: //commonMain implementation…
1
vote
1 answer

Custom JSON contract resolver to ignore all properties without a custom annotation

I'm looking to combine [JsonProperty("name")] and ![JsonIgnore] into my own custom resolver and I just need some help on the syntax. So when serializing this class I want to ignore all properties without my custom attribute and also specify the…
Izak Joubert
  • 906
  • 11
  • 29
1
vote
1 answer

CosmosDB per item ttl setting throwing exception: Cannot deserialize the current JSON object

I am following this documentation to set per item ttl to a CosmosDB table entries. But when I add a field name ttl in the entity class I am facing the below error while making Insert/Replace calls: Cannot deserialize the current JSON object (e.g.…
1
vote
2 answers

how to make a public property even with underscore in dart?

I'm fetching some json data from a rest api server and one of its keys is _id and I need to serialize this json to a dart object using built_value, but this isn't allowed because in dart _id is private and built_value doesn't allow me to define a…
Mahdi Dahouei
  • 1,588
  • 2
  • 12
  • 32
1
vote
1 answer

Unity serialize some part of class to json

I want to send some part of class to server. sending Info [Serializable] public class SendingInfos { public string tempID; public string playerLettersInHand; public string playerLettersMiddle; public int playerBet; public string…
Jsennin
  • 153
  • 2
  • 12
1
vote
2 answers

Binary JSON format that supports traversal

Does anyone know of a serialisation format that: Is binary and at least relatively compact, Can store JSON-style data (not Protobuf, Thrift, etc.), Supports traversal (i.e. you don't need to parse the entire document to read one part of it),…
Timmmm
  • 88,195
  • 71
  • 364
  • 509