gson Questions
7
Solved
I was wondering if somewhere out there exists a java library able to query a JSONObject. In more depth I'm looking for something like:
String json = "{ data: { data2 : { value : 'hello'}}}";
...
...
6
Solved
I use this class to store data
public class Item(var name:String,
var description:String?=null){
}
And use it in ArrayList
public var itemList = ArrayList<Item>()
Use this code to seri...
7
Solved
I have downloaded eclipse and installed the spring suit into it.
I have written a JPA based Rest application by following one of the spring.io guides. When I try to run it as spring boot applicatio...
Schubert asked 25/4, 2018 at 21:8
4
Solved
I'm writing an SDK for a JSON API and I'm running into a seemingly weird problem. The API is quite strict in it's POST data validation and it does not allow certain parameters to be present when up...
3
Solved
I'm trying to retrieve JSON data from an external source for practice. I have gotten all the code in place but for some reason I get an error saying that the document is not fully consumed. I have ...
Hagberry asked 18/1, 2018 at 13:19
2
Solved
I'm getting this annoying ClassCastException when I obfuscate my Java code (which works fine before I obfuscate using ProGuard).
java.lang.ClassCastException: com.google.gson.internal.StringMap c...
Bussey asked 8/5, 2015 at 10:32
6
I have JSONs with a date-time attribute in the format "2014-03-10T18:46:40.000Z", which I want to deserialize into a java.time.LocalDateTime field using Gson.
When I tried to deserialize, I get th...
3
I have created a sealed class for the json field Value under CustomAttribute data class. This field can return String or Array of Strings.
How can we deserialize this sealed class from json?
dat...
Inattentive asked 17/2, 2020 at 10:8
2
Solved
Given a POJO:
class Person {
@Expose
String name;
@Expose
String phone;
@Expose
String fax;
}
I want "phone" to be serialized at all times, but "fax" only when it is not null. So given a P...
3
Solved
I had a problem with how to remove elements that do not match certain parameters. For example, I have two data classes: First and Second
First one contains properties for second i.e. city, price et...
3
Solved
I have a simple enum:
public enum Season {
@SerializedName("0")
AUTUMN,
@SerializedName("1")
SPRING;
}
Starting some version, GSON became able to parse such enums. To make sure, I did this:
...
6
I have a response object like this:
public class TestResponse {
private final String response;
private final ErrorCodeEnum error;
private final StatusCodeEnum status;
// .. constructors and ...
3
Solved
I am using spring-boot to develop backend services. There is a scenario to compare 2-beans(one is the DB object and another one is the client requested object) and return the "new element","modifie...
7
Solved
I have method that have to check if JSON is valid, found on How to check whether a given string is valid JSON in Java but it doesn't work.
public static boolean isJson(String Json) {
Gson gson = ...
5
Solved
6
Solved
I have a tree object in JSON format I'm trying to deserialize with Gson. Each node contains its child nodes as fields of object type Node. Node is an interface, which has several concrete class imp...
Frangipane asked 2/9, 2010 at 17:28
7
Solved
My code works perfectly without proguard, but GSON doesn't work when proguard is enabled.
This is the part of code where it doesn't works
JSONArray mensaje = response.getJSONArray("categorias");
...
Brigittebriley asked 5/8, 2015 at 23:16
3
Solved
I have a gson.JsonObject object. What is the easiest way to create a org.json.JSONObject object from it?
4
Solved
I'm working on an app that is using Gson as JSON deserializer and needs to deserialize polymorphic JSON from REST API. Before explaining mi issue note that I've already been looking around polymorp...
11
Solved
i have a class A which has some private fields and the same class extends another class B which also has some private fields which are in class A.
public class A extends B {
private BigDecimal ne...
6
Solved
I knew this question has been asked before. Due to my novice skill in java and android. I can't resolve this issue for more than a week.
One of my friend and i developing an android project were ...
4
Solved
I'm trying to parse some json with Gson and I have following problem:
This is my json:
[{
"label": "Check Digit",
"value": "W"
},
{
"label": "Equipment",
"value": [
"With Standard Liftgate",...
3
Solved
The following code used to work on Java 11:
new Gson().toJson(new Exception())
On JDK 17 I get the following error:
Unable to make field private java.lang.String java.lang.Throwable.detailMessage ...
2
Solved
Getting deprecated message for JsonParser for Spring Boot app,
JsonObject jsonObject = new JsonParser().parse(result).getAsJsonObject();
What is the alternative?
Steere asked 20/3, 2020 at 9:18
2
Solved
Getting deprecated message for JsonParser for Spring Boot app,
JsonObject jsonObject = new JsonParser().parse(result).getAsJsonObject();
What is the alternative?
Nganngc asked 20/3, 2020 at 9:18
© 2022 - 2024 — McMap. All rights reserved.