Android 如何使用Volley发布json数组

Android 如何使用Volley发布json数组,android,json,android-volley,Android,Json,Android Volley,我必须使用截击在服务器上发布三个参数 1) 预约 2) 探访 3) 药品(json药品ID,例如[1,2,4]) 这是我的密码 Map<String, String> params = new HashMap<String, String>(); params.put("appointment_id", "" + appointment_id); params.put("visit_notes", "sdssdsd"); params.put("medic

我必须使用截击在服务器上发布三个参数

1) 预约

2) 探访

3) 药品(json药品ID,例如[1,2,4])

这是我的密码

  Map<String, String> params = new HashMap<String, String>();
  params.put("appointment_id", "" + appointment_id);
  params.put("visit_notes", "sdssdsd");
  params.put("medicines", "1");
  getInstance().HttpPOSTRequestWithParameters(getApplicationContext(), ADD_PRESCRIPTION_API, params,AddPriscriptions.this);
Map params=newhashmap();
参数put(“约会id”,“约会id”);
参数put(“访问注释”、“SDSSD”);
参数put(“药物”、“1”);
getInstance().HttpPOSTRequestWithParameters(getApplicationContext(),ADD_PRESCRIPTION_API,params,AddPriscriptions.this);
通过上面的代码,除了药品(服务器返回的药品的空数组)之外,所有发布的内容都被发布了。这意味着我以错误的方式发布到服务器


我不知道如何发布JSON数组,因为我必须将[1,2,4]发布到服务器。感谢您的建议。

由于hashmap的接收类型是
,请尝试将JSON数组转换为字符串,然后将其放入params hashmap中

像这样

params.put("medicines", "[1,2,4]");