I have a .NET Core 2.0 application where I am returning validation errors when registering a new user like this:
    var existingUser = await _userManager.FindByEmailAsync(model.Email);
    {
        if (existingUser != null)
        {
            return BadRequest(new IdentityError()
            {
                Description = "This email address has already been registered."
            });
        }
    }
    var result = await _userManager.CreateAsync(user, model.Password);
    if (result.Succeeded)
    {
        return new JsonResult(result);
    }
    return BadRequest(result.Errors.ToList());
In my Angular 5 application I have the following code:
this.userService.register(this.model)
  .finally(() => this.isRequesting = false)
  .subscribe(
    result => {
      if (result) {
        this.alertService.success('Registration successful', '', false, true);
        this.router.navigate(['/login']);
      }
    },
    error => {
      console.log(error)
      this.alertService.error(error, 'Registration failed', false, false);
    });
My console.log(error) line brings this:
How do I parse the JSON to just extract the 'description' fields and wrap paragraph tags around them?


error.error[0].description