Questions tagged [json-annotation]

20 questions
5
votes
1 answer

JsonSerializable and JsonKey issue after upgrade on Flutter Freezed model

My app was running ok but after pub upgrade --major-versions I am getting problems on all models. Example model: import 'package:app_220/models/Leads/LeadFieldModel.dart'; import 'package:flutter/foundation.dart'; import…
2
votes
1 answer

How to delegate a call to a method in json_serialization?

I've two classes Foo and Bar: @JsonSerializable() class Foo { final Bar bar; Foo(this.bar); factory Foo.fromJson(Map json) => _$FooFromJson(json); Map toJson() =>…
iDecode
  • 22,623
  • 19
  • 99
  • 186
2
votes
1 answer

Spring boot @JsonProperty to map nested object through parent.child path

I have the following Data structure coming to my server through an Http call person { name: "xyz", age: 30, status: { cd: "M", desc: "Married" } } Then I have the following entity class @Setter @Getter public class Person { …
Saher
  • 105
  • 1
  • 13
1
vote
0 answers

RestAssured RequestSpecificationImpl body method removing "is" from the fieldName

I have the Feature class as follows: public class Feature { private FeatureType featureType; private Integer featureNumber; @JsonProperty("isActive") private boolean isActive; @JsonProperty("isAutomatedFeature") private boolean…
SanQA
  • 233
  • 3
  • 9
1
vote
1 answer

json_serializable flutter parse and map with key connect with modal and mapper

Thais is my json format "recommended": { "section_title": "Recommended", "section_sub_title": "Recommended", "data": { "Allahabad": [ { "gym_id": "9", …
1
vote
1 answer

How to have dynamic multitype value in Dart/Flutter when using @JsonSerializable()?

I am using Flutter with json_annotation library and have one data class that is used to represent json response coming from one api. import 'package:json_annotation/json_annotation.dart'; import 'package:app/dtos/user.dart'; import…
Kristi Jorgji
  • 1,154
  • 1
  • 14
  • 39
1
vote
1 answer

Adding more than one converter in ChopperClient flutter

I am creating different .g.dart classes using json-annotation for different set of responses. Now when I am using Chopper Client for making requests and mapping responses into model classes, I am creating converter. But I can only assign one…
vivek_ios
  • 173
  • 3
  • 13
1
vote
0 answers

Store other key's value in the dart model if first one is null - Flutter

I'm using the json_annotation package to build my dart model. I have a situation where I need to store either value from the API response in my name key. API is returning two keys alias and name. In my model, I need to store the value in such a way…
Yashwardhan Pauranik
  • 5,370
  • 5
  • 42
  • 65
0
votes
1 answer

flutter dio is returning DioErrorType.unknown

I'm using clean architecture on a project and using dio as http package and I've added pretty DioLogger as a dio inceptor to log requests and response. the pretty dio logger is logging a reponse of 200 ok but I'm getting instead of a correct dio…
siba36
  • 45
  • 9
0
votes
0 answers

Download output file from Kaggle kernel

I have modified a notebook on the Kaggle kernel. The output file is saved in the /kaggle/working, but as I look into the files, the web page crashes every time. I tried this solution Download Kaggle output file as well but it did not work for me.…
Tahmid
  • 21
  • 3
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
3 answers

Image annotation conversion from json format to YOLOv7 format

I am trying object detection in YOLOv7. As I have downloaded some public dataset for training, I got annotations in JSON format. { "width": 4608, "height": 3456, "ispano": false, "objects": [ { "key": "o5a4uvvzxdp6dod5uiexhl", …
0
votes
1 answer

freezed package can not generate toJson code for nested object anymore

We've discovered an issue in our monorepo that prevents us from generating .g.dart files for our models. Most of the models are deeply nested and need fromJson/toJson methods to communicate with our backend. Three weeks ago we updated freezed and…
0
votes
1 answer

Is it possible to define enum with same jsonValue() in Dart?

Can I define enum like this?: what is the best way to handle different type values with the same key like this: enum type{ @JsonValue(0) @JsonValue(1) @JsonValue(3) @JsonValue(9) @JsonValue(10) @JsonValue(11) @JsonValue(12) add, …
1
2