Q:

Asp net cannot accept json with brackets [ ]

Here is my method how i create a register into Asp net 
 public class RegisterBindingModel
    {

        public string Email { get; set; }
        public string Password { get; set; }
        public string ConfirmPassword { get; set; }
    }
    async void Register(string email,string password, string confirmPassword)
    {
        List<RegisterBindingModel> mItems = new List<RegisterBindingModel>();
        mItems.Add(new RegisterBindingModel { Email = email, Password = password, ConfirmPassword = confirmPassword });

        var json = JsonConvert.SerializeObject(mItems);
        using (var client = new HttpClient())
        {
            client.Timeout = TimeSpan.FromMilliseconds(20000);
            var response = await client.PostAsync("http://localhost:49826/api/Account/Register", new StringContent(json, Encoding.UTF8, "application/json"));

            if (response.IsSuccessStatusCode)
            {
                string content = await response.Content.ReadAsStringAsync();
                Console.Write((int)response.StatusCode);

            }
            else
            {
                string content = await response.Content.ReadAsStringAsync();
                Console.Write((int)response.StatusCode);

            }
        }

    }
    private void button1_Click(object sender, EventArgs e)
    {
        Register("dimitris2@in.gr", "Password1?", "Password1?");
    }

I am getting error 400 Invalid request Cannot deserialize the current json array eg 1,2,3... If i will remove first and last bracket from string , then it works. But it is not standar json format. How can fix this?
This is how my string looks like:
[{"Email":"dimitris2@in.gr","Password":"Password1?","ConfirmPassword":"Password1?"}]

A:

It looks like you are passing a single-element array to the server, while the server expects a single element coming by itself. This can be addressed by serializing the object without adding it to the list:
var json = JsonConvert.SerializeObject(new RegisterBindingModel {
    Email = email,
    Password = password,
    ConfirmPassword = confirmPassword
});

