How to get all users by user_login as a json_encode array?

Try this one:

function prefix_get_users(){
  $args=array(
    'blog_id' => $GLOBALS['blog_id']
  );
  $all_users=get_users($args);
  $arr=array();
  foreach ($all_users as $val) {
    $arr[]=$val->data->user_nicename;
  }
  die(json_encode( $arr ));
}

Reference: https://codex.wordpress.org/Function_Reference/get_users

error code: 523