Questions tagged [json-serialization]

302 questions
1
vote
0 answers

How to convert enum type into string while serialization

While Json Serialization I got below result: { "Action": 0 } But I want to change the result as string instead of 0 { "Action": "Include" } public enum FAction { Include = 0, } I have property using this Enum. public FAction Action { get;…
Kiruthika
  • 23
  • 5
1
vote
1 answer

Scala Json4s CustomKeySerializer

I'm trying to make all keys in a json object formatted in PascalCase when serializing a case class. It looks like the right way to do this is to define a CustomKeySerializer from the org.json4s package and reformat keys as I wish. However, while I…
jdrub
  • 13
  • 4
1
vote
0 answers

How to serialize JsonSubType with child interface instead of subclass?

How can I get Jackson to serialize the type using the child interface (Cat below) instead of the subclass (Lion)? Parent interface Animal @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property =…
1
vote
1 answer

Serialize to JSON a class that hides member of base class

There are two classes: class Document { public DocumentItem[] DocumentItemList { get; set; } } class DocumentViewModel : Document{ public new DocumentItemViewModel[] DocumentItemList { get; set; } } DocumentItemList in derived class hides…
Tschareck
  • 4,071
  • 9
  • 47
  • 74
1
vote
1 answer

Spring Boot Jackson and Data serialization

In my Spring Boot application I use a following DTO with @RestController: public abstract class ComparableQuery extends BaseQuery { private final Object value; ... } Everything works fine but when I use Spring RestTemplate and pass…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
1
vote
2 answers

Jackson Json to POJO mapping

i am i little lost in creating a mapping with jackson. My Json has the following structure { "d": { "__metadata": { "uri": "https://apisalesdemo8.successfactors.com:443/odata/v2/JobApplication(1463L)", "type":…
Mathias Maerker
  • 460
  • 6
  • 16
0
votes
1 answer

Construct dictionary with array value instead of serialized JSON string

I have some data from the bind grid view and I want to display them in a serialized format. Right now I have a nested array where the above parent is serialized correctly but the child array has escape characters and slashes. private List
0
votes
1 answer

Check if json is deserializable to a specific type using Json.NET

I have a data model where several data classes are defined. This data classes are serialized in a Unity project (namely A) and then sent via TCP to another Unity project (B) which acts as a debugging tool. By the way, A and B only share the data…
0
votes
0 answers

Internal toJson()-Method is not generated

I am having the following UserDto class: part 'user_dto.freezed.dart'; part 'user_dto.g.dart'; @freezed abstract class UserDto implements _$UserDto { const factory UserDto({ required String userId, required String userName, required…
SRel
  • 383
  • 1
  • 11
0
votes
0 answers

How to persist a Blazorise Theme

I have been using Blazorise to try out an app and am using Themes to control the colour scheme. I want to allow a user to save their own Theme in the DB and so I need to find a way of serialising it and getting back to the server. When I use the…
Brett JB
  • 687
  • 7
  • 24
0
votes
1 answer

How to Represent a Union Type in Dart Similar to TypeScript for Creating a Data Class with json_serializable?

I am currently working on a Flutter project where I am trying to create a data class for a User that involves an Image property. In TypeScript, I have a union type Image that can be either a boolean or an array of { quality: string; link: string }…
0
votes
1 answer

Web API - Problem with PostAsync (http Rest) calls

Good morning, I have a big problem with routing (I guess) for http Post calls. I use .Net 6. I have the following call which works fine: HttpResponseMessage response1 = await client.GetAsync("http://localhost:6000/api/" +…
0
votes
2 answers

Problem encoding JSON for a UrlRequest in Swift

I'm trying to set up an API service. I have a simple login call that looks like this: enum HttpMethod: Equatable { case get([URLQueryItem]) case put(Data?) case post(Data?) var name: String { switch self { case .get:…
soleil
  • 12,133
  • 33
  • 112
  • 183
0
votes
1 answer

jsonserializationexception: self referencing loop detected for property

I'm using C# asp.net core ef6 linq mssql VS2022 when I build the project I can see this page I checked these pages... 2 3 the 2's JsonIgnore was worked but I have problem. I using ef core power tools ef core power tools and ef core help me when I…
0
votes
1 answer

Parse JSON-Map to object with json_serializable when keys are unknown

I want to deserialize an http-response of following format. { "12-34": "some value", "45-67": "another value", ... } I don't know how to create a DTO class with json_serializable annotation if I don't know the keys and the number of keys…
Th.Fr.
  • 13
  • 3