The death comes as a shock not only because it's not canon from the books, but because Clary and Jocelyn had just found a way to reconnect. Jocelyn was kidnapped in the pilot episode of Shadowhunters and was largely absent from Season 1, with the exception of flashbacks, as Clary discovered her family's history of hunting supernatural beings. Jocelyn returned alive and well at the beginning of Season 2, but she and her daughter had a hard time seeing eye to eye as Clary began to stand on her own and couldn't forgive her mother for keeping such a huge part of her identity a secret for most of her life.
However, as McNamara explains in the TVGuide.com exclusive featurette, Jocelyn's death is a heartbreaking but necessary step in Clary's evolution as a Shadowhunter. The choice to kill a character that lives in the books is also to keep the show exciting and to keep all the fans guessing. For the executive producers, Jocelyn's death felt necessary to raise the stakes and to be able to move the core cast forward.
Shadowhunters airs Mondays at 8/7c on Freeform.