Questions tagged [json-serialization]

302 questions
0
votes
0 answers

error when serializing a BsonDocument using System.Text.Json in .net 6.0

I have a c# class as following: public class Product { public string ProductName { get; set; } public int ProductCount { get; set; } public BsonDocument ProductMetadata { get; set; } } The BsonDocument is coming from the…
0
votes
0 answers

Object Mapper configuration not working for nested objects from thirdparty libraries in Springboot

I have a srping-boot application which is returning a nested object as below: here the time_to_ship nested object is coming from a third-party-jar and the "name" object is coming from an internal model object.the "name" object is anotated with…
0
votes
2 answers

I can't get the Jackson object mapper to set the type correctly

I have this json: { "List": [ { "Field1": 1678493915, "Field2": "A string" } ] } When I define this method in a helper class: public static Map>> readJSON(String json) throws JsonProcessingException { …
italktothewind
  • 1,950
  • 2
  • 28
  • 55
0
votes
0 answers

Is it possible to serializing UUID keys in a Python dictionary

In Python, the json module allows for custom types to be serialized via either the cls or default named arguments. However, this does not seem to work for the keys in a dictionary as per the following code snippet. import json import uuid #…
mallwright
  • 1,670
  • 14
  • 31
0
votes
1 answer

fromJson and toJson not generated when the build code is put in build.yaml file

If I use the following code in pubspec.yaml file, then the build_runner generates code but if I put it in the build.yaml file, then the code is not generated for fromJson and toJson. targets: $default: builders: json_serializable: …
iDecode
  • 22,623
  • 19
  • 99
  • 186
0
votes
2 answers

Getting “Cannot find 'data' in scope” error message in URLSession-related code Swift

I’m trying to convert escaping closure code to async-await code in a certain file. More specifically, I’m trying to not use the completionHandler way of using the URLSession.shared.dataTask line of code in this file (which is specifically the line…
cg1000
  • 7
  • 4
0
votes
2 answers

How to deserialise a `StructureDefinition.Snapshot.Element` list

Using the NHS LFPSE FHIR resource at https://psims-uat.azure-api.net/taxonomy/fhir/StructureDefinition/adverse-event-estimated-date-4 I want to save the StructureDefinition.Snapshot.Element list into my database so I can process it later. To do this…
Mark Cooper
  • 6,738
  • 5
  • 54
  • 92
0
votes
2 answers

Filling ASP.NET Grid view with data by calling API URL

My objective is to fill a table in ASP.NET Webform, by calling API url. But getting some serialization issues. Any help would be much appreciated. I assume there is some issue with serialization and deserialization. But unable to resolve that.…
Guru
  • 47
  • 6
0
votes
0 answers

Class A is not equal to class B with Equatable

here is my model class for a response from the server @JsonSerializable(createToJson: false) @immutable class Miner extends Equatable { final String minerId; @JsonKey(name: 'name') final String minerName; @JsonKey(fromJson: _isOwnerToJson) …
0
votes
1 answer

How to convert object to Json in .net core 6 JsonConverter

Im trying to convert a object that looks like the object below into Json in .net core 6? {{ "Id": "178", "DisplayName": "Jon Doe", "Email": "JonDoe@gmail.com", "FullName": "Jon Doe", "UserName": "jdoe" }} Before upgrading to .net core 6…
eia92
  • 81
  • 2
  • 12
0
votes
0 answers

Flutter Json Serialization issue- JSON Convert

No classes that inherit JsonConvert were found, the project root directory must contain the lib directory, because this plugin will only scan the lib directory of the root directory
Dark_Clouds_369
  • 658
  • 1
  • 6
  • 24
0
votes
0 answers

How to use JsonSerializable on function in Flutter

I want to improve the functioning of my application a bit using json_serializable. I use the https://www.thecocktaildb.com/api.php Here is the code for the model that is currently in the app. ` class CocktailModel { final String name; final…
0
votes
2 answers

Is there a way to get the JSON enum value when using @JsonEnum(fieldRename)

I was searching a way to serialize & deserialize my enum with different cases (camelCase to snake_case) and I discovered the @JsonEnum parameter offered by the Json_serializable package. That's exactly what I needed! It works perfectly for…
0
votes
1 answer

Flutter error: _InternalLinkedHashMap' is not a subtype of type 'Map

I am using json_annotation to generate the fromJson and toJson functions for my custom class ItemStatus: import 'package:json_annotation/json_annotation.dart'; part 'item.g.dart'; @JsonSerializable(explicitToJson: true, anyMap: true) class…
0
votes
1 answer

Specify jackson serialization as an object method

I am looking for a class to implement its own json serialization in a method. I guess it could extend JsonSerializer, but that's a little heavy. Is there any other way? This is what I am looking for. public class MyClass { private int…
f.khantsis
  • 3,256
  • 5
  • 50
  • 67