I have the following code for convert a JSONObject into a StringEntity that I will send via a HTTP post request. This is working fine on an actual device with KITKAT, but when I try in the emulator with API10, I got an error from the server.

```
JSONObject jsonRequest = new JSONObject();
//filling the jsonRequest with data
System.out.println(jsonRequest.toString());
StringEntity se = new StringEntity(jsonRequest.toString());

```

I have realize that the way JSONObject#toString works is different in API10 and API19 and that is why the server is returning a 500 error. This is what the println outputs:

API19

```
{"expenses":[{"category":"660","attachment":{"data":"\/9j\/4...

```

API10

```
{"expenses":[{"category":"660","attachment":"{data=\/9j\/4...

```

Note the equals symbol(=) instead of colon (:) and the different position of the quotes (").

The json should look like

```
{
   "expenses":[
      {
         "category":"123",
         "attachment":{
            "data":"akcsdc...sdc"
         }
      }
   ]
}

```

Why is this happening? Is there a better way to do this?

Thanks.