How to send JSON data to a server using Java

I am trying to create a POST request to send JSON data to a server using a REST api.

Since JSON code will be embedded in the request body as the value of the request parameter, do you need to encode the value to call special characters, such as '{} []', which you usually find in JSON syntax.

Is there any utility library?

N.

+3
source share
2 answers

The request body must not be URL encoded. Take a look at HttpClient . This is the de facto library for issuing POST requests.

+2
source

SOJO Java. . , - , HTTP-, Apache HTTP Client .

0

Source: https://habr.com/ru/post/1709597/


All Articles