tags:

views:

1658

answers:

2

Hi,

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

As the JSON code will be embedded in the request body as a request parameter value, do I need to encode the value to escape special characters like '{}[]' you typically find in JSON syntax.

Is there any utility library to do that ?

N.

+1  A: 

The body of the request needs not to be URL encoding. Have a look at HttpClient. It is the de-facto library for issuing POST requests.

kgiannakakis
A: 

SOJO works serialization of Java structures pretty well. But you will not need to do any escaping in the body. And as someone else suggested, for doing the actual HTTP requests, the Apache HTTP Client project is a solid choice.

altCognito