Skip to content
Advertisement

How to send post request in java with a JSON body

I am confused as to how to send a post request in Java with JSON parameters. I have seen many examples that use HttpPost library which I can not access. Below is my code:

JavaScript

} class main {

JavaScript

I am trying to pass the json in the main method (I know I am not doing it right), and was wondering as to how I would do this correctly.

Advertisement

Answer

This Question is asked before here: HTTP POST using JSON in Java

See it and comment this if you face any problem.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement