Answer the question
In order to leave comments, you need to log in
Is it possible to parse a josn file without creating an object of it?
I have json file: people.json
and following code:
Gson gson = new Gson();
Person person = new Person();
try{
FileReader fr = new FileReader("/home/xxx/IdeaProjects/hw/src/people.json");
person = gson.fromJson(fr, Person.class);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Answer the question
In order to leave comments, you need to log in
1. Well, ok, let's say you somehow parsed your json ... And then what? Do you need to work with this information somehow? And here it turns out that it is most convenient and logical to use a class.
2. Nothing happens here. Streams and lambdas are not needed here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question