I am writing an HTTP Publish request in Java using Apache HttpPost and MultipartEntity. Within the data area of the request, I can add simple parts using addPart(name, StringBody). However, I have to add part of the body that's a range of values. How do you do that? The example from the curl request is:

curl -k -H "Content-Type: application/json" --data '{ "name":"someName", 
"email":"noone@nowhere.com", "properties" : { "prop1" : "123", "prop2" : "abc" }}' 
-X POST 'https://some.place.com/api/test'

In Java, I'm able to produce the request such as this, but I have to understand how to produce the "qualities" array value since StringBody is perfect for just one value:

HttpPost httpPost = new HttpPost(newAdultUrl);
MultipartEntity entity = new MultipartEntity();
entity.addPart("name", new StringBody("someName"));
entity.addPart("email", new StringBody("noone@nowhere.com"));
entity.addPart("properties", new ??? );

Interesting help!

Within the StringBody pass a technique that converts an assortment to json.
For instance JSONArray

new JSONArray(collection).toString()

Here's one approach that actually works using StringEntity rather than MultipartEntity:

HttpPost httpPost = new HttpPost(newUrl);
String jsonData = <create using your favorite JSON library>;
StringEntity entity = new StringEntity(jsonData);

I must see a solution using MultipartEntity if there's one, but this can complete the job.

You need to call addPart for every worth of the array:

entity.addPart("properties", new StringBody("value 1");
entity.addPart("properties", new StringBody("value 2");
entity.addPart("properties", new StringBody("value 3");

Required me a while to decipher it, also it labored with what I had been doing. I could not use JSON because I could not control the receiving finish...