In Kotlin, how does GSON.fromJson(…) manage to mutate a read-only field of an existing object?

In Kotlin, how can an instance’s read-only val field be mutated? In the following Kotlin code, gson.fromJson(…) gets a Thing(0) from the InstanceCreator and somehow manages to mutate value from 0 to …

Gson Failing to call custom Serializer

I’ve been trying to follow the advice given here to turn off scientific notation on numeric values represented in Json. The problem I’ve got is that my custom Serializer is never called. I’ve tried …

Connect two HashMap Values

I’ve got this JSON string: String json = “{“countries”:{“2″:”China”,”3″:”Russia “,”4″:”USA”},”capitals&…

How to convert an xml into a json using gson library

I have to convert a XML using gson library into a JSON i haven´t found how to do it using gson library(java)

How to avoid Jackson escaping double quotes in Java?

I am working on a project and wanted to rewrite some code written in Gson to Jackson using ObjectMapper. So I am trying to create a JSON string using some properties as below: ObjectMapper …

GSON – trim string during deserialization from JSON

I have a JSON string that is parsed using the GSON library into a Map like so: static Type type = new TypeToken<Map>() {}.getType(); // note the trailing/leading white …

Abstract class with Gson serialization/deserialization

I am expecting to get from a json a LinkedList. The pojos look like this: @Data @Builder public class Request { private String id; private List parameters; } @…

Gson library is not working reliably as intended for parsing large JSON file

I have to parse a really huge JSON file (file size can get to several GBs), so I cannot just load the entire JSON String into the memory and parse it into an object, I have to somehow read the JSON …

How to dynamically cast an object (of class Object) to the method return type using ASM?

What I want to do is to modify a method using ASM: I push an object (of class Object) to the stack I want to cast that object to the return type of that method Return that casted object. My code in …

How to fix this unchecked assignment warning?

var blks = ReflectionHelper.getClasses(“PACKAGE_NAME”); var blockRta = RuntimeTypeAdapterFactory.of(Block.class); for (var c : blks) { if (Block.class.isAssignableFrom(c)) { blockRta….