Category "gson"

Unable to invoke no-args constructor for class ConversionRates

I have a Currency Converter Android app. I 'm using retrofit for getting rates from API but as far as I'm concerned my app can't get data from api and it return

Parsing empty json array as null object with GSON

I am working with some not really well designed APIs and when the object is null it returns empty array, like this: No-null response: "SourceType": { "ID": "2

GSON JsonObject and LinkedTreeMap

I noticed there wasn't an easy all-inclusive (POJO-free) way to convert (in GSON) a JsonArray to a List. I found an example that uses a TypeToken and when I tri

Moshi : Generic Json converter for Room entity

I am trying to create a generic JSON parser String to Object with Moshi but I am not sure if I am doing it right as I am stuck in a scenario which needs to deal

Convert of JSON to a java object and a list of java objects

I get this JSONObject response from an API { "meta": { "code": 200 }, "data": { "tracking": { "id": "lk46hwgbadfqcl2fyacyw00q", "c

Get key values of nested json objects

I want to get the values of the keys of the next json file using org.json library: { "1": { "subject1": "MIS", "subject2": "DBMS", "

Android generic Gson.fromJson() conversion with coroutine and flow

I am making generic classes for hitting otp api.anybody can use otp section just have to pass request ,Response class and url and all will be done by this otp s

Kotlin 1.6.0 (There are no problems in 1.5.21) + Proguard + Gson (Registering an InstanceCreator with Gson...)

I have enabled Proguard and configured the rules minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFil

change the json object value

{ "onboardingInformation": { "apiInvokerPublicKey": "string", "apiInvokerCertificate": "string", "onboardingSecret": "string" }, "notification

export and import gson - Failed to invoke public ) with no args

i'm learning how to convert array to json file and import that array with using gson. I have abstract class Shape; public abstract class Shape { private Type ty

Simple java questionnaire using json

I made a simple questionnaire. I need to write the responses to a JSON file. How to do it? I use IDEA Intellij and library GSON for work with JSON. This is main

How to make GSON fail on unknown properties

I need GSON mapper to throw an exception if json contains unknown fields. For example if we have POJO like public class MyClass { String name; } and json l

Java 17 | Need Help to update to Gson 2.9.0 and disableJdkUnsafe

I'm trying to Update my Gson version to 2.9.0 and disableJdkUnsafe, Can I get help with below error. This is from a broken test when I updated my GsonBuilder. T

Java application for sorting and selecting

I need to develop a simple application for sorting and selecting data according to predefined rules. The application must be able to work with JSON lists of obj

How to modify values of JsonObject

I want to add a new field to jsonObject and this new field's name will be based on a value of another field. To be clear, this an examples of what I want to ach

How to modify values of JsonObject

I want to add a new field to jsonObject and this new field's name will be based on a value of another field. To be clear, this an examples of what I want to ach

Gson.toJson object contain URL

I am using Gson.toJSON method. My pojo contains one of attribute as URL string. Strange thing is Gson converter changes URL characters output is: /myApp/myAct

How to unrealize a json using GSON? Get an error

The structure of the json that I have stored in a string is: { "0": { "PDate": "2019-02-25 00:00:00.0000000", "DDate": "2019-06-25 00:00:00.000