Writer Ned Vizzini, whose novel about teenage depression was adapted into the Zach Galifianakis film “It’s Kind of a Funny Story,” died Thursday in New York. The New York city medical examiner said he committed suicide.

Vizzini’s book “It’s Kind of a Funny Story,” published in 2006, was a semi-autobiographic story of a high school student who ends up in a mental hospital after a suicide attempt, and became a 2010 movie (pictured).

He was working on NBC’s J.J. Abrams and Alfonso Cuaron show “Believe,” due in March, and had also written for “The Last Resort” and “Teen Wolf.”

His other books included young adult novels “Be More Chill” and “The Other Normals”; essay collection “Teen Angst? Naah” and middle-grade series “House of Secrets,” co-written with director Chris Columbus.

Raised in New York, he attended Hunter College and while still a teenager, began writing for publications including the New York Times, New York Press and the New Yorker.

He is survived by his wife, Sabra, and a son.