title: please how can I post String in array Object JSON in android retrofit
body: <p>please How can I post this JSON</p>
  <pre><code> {
    &quot;name&quot;: &quot;Premium Quality&quot;,
    &quot;type&quot;: &quot;simple&quot;,
    &quot;regular_price&quot;: &quot;21.99&quot;,
    &quot;description&quot;: &quot;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.&quot;,
    &quot;short_description&quot;: &quot;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.&quot;,
    &quot;categories&quot;: [
      {
        &quot;id&quot;: 9
      },
      {
        &quot;id&quot;: 14
      }
    ],
    &quot;images&quot;: [
      {
        &quot;src&quot;: &quot;http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg&quot;
      },
      {
        &quot;src&quot;: &quot;http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg&quot;
      }
    ]
  }
  </code></pre>
  <p>to android with retrofit</p>
  <p>i have successfully sent a string, but this array i cannot
  Like sending a image</p>
  <p>My Code</p>
  <p>API</p>
  <pre><code>    {
  public interface interfaceAPI
  
      @POST(&quot;wp-json/wc/v3/products?consumer_key=ck_006dd346d4c87128f924a93983e7d51be528d1&amp;consumer_secret=cs_d4b421317da42bd58a3f3db6a4cc4644d20a78e3&quot;)
      Call&lt;Product&gt; PRODUCT_CALL_POST(@Body HashMap&lt;Object, Object&gt; map);
  
  
  
  }
  </code></pre>
  <p>CLASS POST</p>
  <pre><code>package com.example.myapplication;
  
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Toast;
  
  import com.example.myapplication.Model.Product;
  import com.example.myapplication.Model.images;
  import com.example.myapplication.callAPI.interfaceAPI;
  import com.example.myapplication.databinding.ActivityPostBinding;
  import com.google.gson.Gson;
  import com.squareup.picasso.Picasso;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.HashMap;
  
  import retrofit2.Call;
  import retrofit2.Callback;
  import retrofit2.Response;
  import retrofit2.Retrofit;
  import retrofit2.converter.gson.GsonConverterFactory;
  
  public class post extends AppCompatActivity {
  
  
      ActivityPostBinding binding;
      private final static int intent_get_img = 1;
  
  
      String name= &quot;name&quot;;
      String regular_price= &quot;regular_price&quot;;
      String src = &quot;src&quot;;
      //String images = &quot;images&quot;;
      images images;
      Uri uriimg;
  
  
      interfaceAPI interfaceAPI ;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          binding = ActivityPostBinding.inflate(getLayoutInflater());
          super.onCreate(savedInstanceState);
          setContentView(binding.getRoot());
  
  
  
  
  
          binding.imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  Intent getimg = new Intent(Intent.ACTION_GET_CONTENT);
                  getimg.setType(&quot;image/*&quot;);
                  startActivityForResult(getimg, intent_get_img);
  
              }
          });
  
  
  
          binding.button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  postproduct();
  
              }
          });
  
  
  
  
  
  
      }
  
      private void postproduct()
      {
          try {
          JSONArray imagesA = new JSONArray();
          JSONObject images =new JSONObject();
  
  
              images.put(&quot;src&quot;, uriimg.toString());
  
              imagesA.put(images);
  
  
              HashMap&lt;Object, Object&gt; post_map =new HashMap&lt;&gt;();
              post_map.put(&quot;name&quot;,binding.productName.getText().toString());
              post_map.put(&quot;regular_price&quot;,binding.price.getText().toString());
              //  images =new images(uriimg.toString());
  
              post_map.put(&quot;images&quot;,new Gson().toJson(imagesA));
  
  
              //method
              getPostCall(post_map);
  
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
  
  
  
  
  
  
      }
  
      private void getPostCall(HashMap&lt;Object, Object&gt; hashMap)
      {
  
  
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(&quot;https://carddoom.com/shop/&quot;)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          interfaceAPI = retrofit.create(com.example.myapplication.callAPI.interfaceAPI.class);
  
          Call&lt;Product&gt; productCall= interfaceAPI.PRODUCT_CALL_POST(hashMap );
  
          productCall.enqueue(new Callback&lt;Product&gt;() {
              @Override
              public void onResponse(Call&lt;Product&gt; call, Response&lt;Product&gt; response) {
                  if (response.isSuccessful()) {
                      Toast.makeText(post.this, &quot;Successfully post Product&quot;, Toast.LENGTH_SHORT).show();
                  }else {
                      Toast.makeText(post.this, &quot;API Error&quot;, Toast.LENGTH_SHORT).show();
                  }
  
  
  
              }
  
              @Override
              public void onFailure(Call&lt;Product&gt; call, Throwable t) {
                  Toast.makeText(post.this, &quot;API Erorr: &quot;+ t.getMessage() , Toast.LENGTH_SHORT).show();
                  binding.button.setText(t.getMessage());
                  Log.getStackTraceString(t);
  
              }
          });
  
  
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode== intent_get_img &amp;&amp; data!= null &amp;&amp; resultCode== Activity.RESULT_OK){
              uriimg = data.getData();
              Picasso.get().load(uriimg).into(binding.imageView);
  
          }
  
  
      }
  
  }
  </code></pre>
  <p>I've tried using JSONObject, but it doesn't work</p>
  <p>HashMap has partially solved the problem.</p>
  <p>I hope to find your help</p>
  <p>Any help would be appreciated :)
  have good days</p>