Here's the code that i used:
function get_users(){
$all_users = get_users();
$arr=array();
foreach ($all_users as $val) {
$arr[]=$val->data->user_nicename;
}
$resp = array (
'data' => json_encode($arr)
);
wp_send_json($resp);
}
this code is working like this:
["john","mark","mena"]
I want the code to work like this:
[{value: "user_nicename", label: "display_name",icon: "user_avatar"}]