Skip to content

Tag: gson

How to set the classpath correctly in java

I need to compile and run simple code using the gson library, but I can’t use Maven, Gradle or the IDE. The directory contains and gson-2.9.0.jar javac -cp gson-2.9.0.jar works correctly and creates Main.class But when I run java -cp ./*: Main, I get I also tried the following commands: But all these commands give the same result.

Streaming large JSON from input stream efficiently in Java

In order to save memory and avoid an OOM error, I want to stream a large JSON from an input stream and extract the desired things from it. More exactly, I want to extract and save some strings from that JSON: files.content.fileContent.subList.text = “some text in file” files.content.fileContent.subList.text = “some text in file2” and save them into a String variable:

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 …