H
H
Hermann Demin2021-07-20 01:05:53
Java
Hermann Demin, 2021-07-20 01:05:53

How to parse json response in java?

Hello,

I would like to know what is the most convenient way to parse responses that come in json format?
There is an API interface that returns information on objects (something about 1000+ objects). I only need id and a couple of values ​​in these objects. I understand that you need to parse and write down everything in iterations, but I don’t fully understand how this can be done in practice.

By the way, in java, it turned out to send get requests, and write the response to a string variable, but it seems to be easier to parse json than a string of several thousand characters.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
Hermann Demin, 2021-07-20
@germann_vladivostok

To solve my problem, I chose the old json-simple.
I advise you to study the structure of Json files before parsing

D
Developer, 2021-07-20
@samodum

Well, for example, gson https://github.com/google/gson

S
Sergey Gornostaev, 2021-07-20
@sergey-gornostaev

There are many different ways. The choice of the most suitable one depends on how you receive this response and where.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question