message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(paramString));
}
private static JSONArray toJSONArray(final Object[] array) throws Exception
{
JSONArray jsonArray = new JSONArray();
for (Object parameter : array)
{
if (parameter instanceof Map)
{
Map<String, Object> map = (Map<String, Object>)parameter;
JSONObject jsonObject = new JSONObject();
for (Map.Entry<String, Object> entry : map.entrySet())
{
String key = entry.getKey();
Object val = entry.getValue();
if (val != null)
{
if (val.getClass().isArray())
{
val = ManagementHelper.toJSONArray((Object[])val);
}
else
{
ManagementHelper.checkType(val);
}
}
jsonObject.put(key, val);
}
jsonArray.put(jsonObject);
}
else
{
if (parameter != null)
{
Class clz = parameter.getClass();
if (clz.isArray())
{
Object[] innerArray = (Object[])parameter;
jsonArray.put(ManagementHelper.toJSONArray(innerArray));
}
else
{
ManagementHelper.checkType(parameter);
jsonArray.put(parameter);
}
}
else
{
jsonArray.put((Object)null);
}
}
}
return jsonArray;