D’Arcy Carden was 36, still struggling to ascend from improv comedy at Upright Citizens Brigade to landing paying jobs as an actress, which was kind of the whole point of all that improvising, when she audition for “The Good Place.” Aside from a few commercials and a small role on “Broad City,” Carden was getting nowhere. She loved doing improv but was starting to feel like she’d spent a decade and a half training for an opportunity that was just not out there, hustling for a future that would never materialize.

The role she auditioned for was that of Janet.

At first, the show’s creator Mike Schur thought his show set in the afterlife needed some sort of “centralized information database.” In heaven, the answers to all your eternal inquiries should await you, whether it was who killed JFK or did Allison from the fourth grade have a crush on me? The original idea was for this information to all be available on a kiosk, but Schur realized it would be exponentially more fun if there was an actual person delivering these details. Or at least something that appeared to be a person, but really was this uncanny valley creature: not a girl, not yet a robot. A Janet.

To keep the details of the spoiler-sensitive series under wraps, aspiring Janets auditioned with a dummy scene, playing a customer service representative for a company that made defective dolls. “We auditioned a million people,” Schur said, “ranging from 13-year-old boys all the way to 75-year-old women and everything in between.” Now, Schur thinks back on casting Janet like that apocryphal story about how Michelangelo carved the David: by cutting away all the marble that wasn’t David. Once they cut away all the Janets that weren’t Janet, they had D’Arcy Carden.

Confident she would not be cast as Janet, Carden went into the room just hoping to make Schur laugh.

It was clear to him from the jump that Carden was perfect for the role. “I feel like I know what Janet is now,” he remembers thinking. “But I know it because of D’Arcy, not because of me.”

While waiting to hear about “The Good Place,” Carden auditioned for a spot on another upcoming show, a dark HBO comedy called “Barry.” She read for Natalie, a sycophantic acting student whose desperation was not entirely unfamiliar to her. “Barry’s” star and co-creator was “Saturday Night Live” alum Bill Hader, with whom Carden was so close — she’d nannied for his kids for years — that she almost took herself out of the running. She figured she wouldn’t get cast and wanted to save her friend that awkward “we’re going in a different direction” phone call.

Hader finds Carden’s hesitation, which he was unaware of at the time, hilarious.

“She probably doesn’t know this, but I just wanted to give her the job,” he said. “That whole part was created for her. The part was probably in the original script as ‘D’Arcy’ and we had to change it to Natalie.”

Within a month, she landed both roles. Now the 39-year-old Carden stars on two of the most critically acclaimed comedies on television. And Janet, a character Carden initially feared might not be dynamic and interesting, has emerged as the uncontested fan favorite in a stacked cast, a hilarious, genuinely odd and undefinable being made real by Carden’s bright, perfectly calibrated performance.

“I think the moment in my life when it came along was really correct for my life,” Carden says. “I really felt so aware that, ‘This doesn’t happen, and it doesn’t happen to you.’ And it finally did.”

(Colleen Hayes/NBC)
(Colleen Hayes/NBC)

Carden knew she wanted to be an actress from the time she was a kid. She wrung laughs from a couple of onstage mishaps during childhood performances and could tell she’d found her calling. After studying theater at Southern Oregon University, she moved to New York City, got a lousy agent who frequently forgot she existed and started taking classes at UCB.

She’s recounting her early days while moseying around the Grammy Museum in Los Angeles, and turns out she’s a pretty perfect companion. There’s the extremely famous photo of Johnny Cash giving the camera the finger at San Quentin Prison, which happened to be taken by one of her dad’s best friends, Jim Marshall. “Jim has taken a bunch of iconic pictures, but I think in this one, Jim was just being annoying to Johnny, and he just flipped him off,” Carden says.

In an exhibition where visitors can get behind a drum kit, Carden briefly showed off the skills she picked up for the briefest of cutaway scenes in “The Good Place.”

“I took a really long drum lesson, and Ted [Danson, her co-star] took a really long bass lesson,” she says. “And both of us really took to it and said we are going to buy drums and bass and take lessons. I don’t think Ted did it. I didn’t, either. But I have kept in touch with my drum teacher! She’s rad.”

While devoting herself to improv, Carden said she went on a million weird auditions where the person auditioning her would call her “honey.” She estimates she booked two or three commercials the entire time she was in New York.

She lived in unlivable apartments — an illegal sublet crammed with the real tenants’ belongings; an attic room with no insulation. To afford such swanky accommodations, Carden nannied, which she loved, and temped, which she did not love. One day she’d “be a receptionist with a bunch of Wall Street dudes being terrible,” the next she’d go to some “soul-sucking” office wearing a god-awful pantsuit from Burlington Coat Factory. She did time as a guide on a New York City tour bus. “One of those jobs where you can tell yourself, ‘I’m acting!’ ” she says. “But you are so not.”

Her 20s crept into her 30s. She was subsisting off snacks stolen from offices, parsimoniously portioned leftovers and late-night pizza slices. “That was a rough few years, when I was doing dirty comedy in the basement of the UCB theater and [my friends] were getting married and having babies,” she says. “I’d be getting wedding invites in the mail and going, ‘Cool! Can’t afford the flight. The idea of getting a hotel is truly hilarious.’ ”

“Those are the type of moments where you’re like: I missed it. I’m not a real adult,” Carden says. “I missed my opportunity to be a successful human being.”

All around her, UCB classmates were leveling up. One day Carden was smoking clove cigarettes with a dejected, unemployed Aubrey Plaza; the next, Plaza was moving to L.A. to do a Judd Apatow movie and “Parks and Recreation.”

Then her friends Abbi Jacobson and Ilana Glazer had their Web series “Broad City” picked up by Comedy Central. Carden thinks of those two as her “little guardian angels”: After casting Carden in a part that was cut from the pilot, they recast her as Gemma, a trainer at Abbi’s gym. “Even though I wasn’t in the show very much,” Carden says, “it changed my career.”

“She was always someone we loved and were in awe by comedically,” Jacobson said. “She’s just a genius.”

“I really feel like she was as good then as she is today, because she’s always appeared so comfortable in her skin,” Glazer said. “It was like she was born onstage or something. She was just so talented.”

Hader, who was still on SNL when Carden was nannying his kids, didn’t realize how funny Carden was until they did a live comedy show together, along with Amy Poehler, Seth Meyers and Zach Woods. Carden, he said, was the funniest of that star-studded group.

“I remember we were in L.A. as a family and she was staying with us watching our kids,” Hader said. “I had this audition and she was like, ‘I can read with you if you want.’ . . . And she was so good! She was really good. I remember being like, ‘D’Arcy is a good actress! Why are you nannying for us?’ I just remember thinking, God, she’s so good. She just needs a break.”

That everyone who came into contact with Carden seemed to recognize that she was an undeniable comedic talent and that it still took almost 20 years for Carden to be rewarded in the traditional fashion — by, say, casting her as a regular on a television show — is one of those showbiz absurdities that Carden’s peers cannot explain.

“I think part of it is, she’s a strong, smart woman, and I feel like the world has been rising to meet D’Arcy,” Glazer said. “Even though she did struggle and hang in there for many years, it kind of has to be the right time. ... She’s been training for this. She’s been ready for this moment.”

When Hader sees audiences appreciating Carden’s success, “I start beaming like a proud parent. It makes me so happy, because she deserves it. She took no shortcuts.”

“I have this wonderful feeling of, this is a person who deserves her success,” Schur said of Carden. “A thing that can make you crazy in Hollywood is there are millions of people out here who seem to get things they don’t deserve. That’s not even Hollywood; that’s America. But she’s just such a good human being. And it makes me so happy that she gets to do this thing she loves, because not for one second do you feel like she doesn’t deserve it.”

(NBC/Colleen Hayes/NBC)
(NBC/Colleen Hayes/NBC)

It may have taken Carden a long time to find her perfect role, but Janet makes up for lost time since the role is like 1,000 in one.

Each region of the afterlife has a different Janet, all of whom are played by Carden. There’s Neutral Janet (beige, monotone, works in accounting), Bad Janet (blond, rude) and Good Janet.

Good Janet is like Joan Holloway, but for the universe: an unflappable, all-knowing presence who seems at first like an overqualified assistant but reveals herself to be the one without whom all operations would cease to function. (Plus everybody has a crush on her.) Because she knows literally everything, she is almost constantly correcting people; somehow, this is never obnoxious. Under duress, she might projectile-vomit pennies or burp up a live frog. At rest, she holds her hands in front of her with her right thumb wrapped inside her left fist, like a plug finding its outlet. She is always smiling just a little bit.

Many of these qualities came not from Schur but from Carden, whose intuitive grasp of what makes Janet Janet reminds Schur of how Steve Carrell understood Michael Scott on “The Office,” where Schur was a writer.

“I remember thinking, Steve Carrell is fluent in Michael Scott. We could design any scenario and he would have this perfect compass for how Michael would behave,” Schur said. “And it’s clear to me that D’Arcy is fluent in Janet. ... Her instincts and her natural abilities to act as Janet in [any] situation are effortless and they come to her right away.”

It’s not just with Janet. For the full Carden experience, just watch Season 3’s “Janet(s)”: Carden played Good Janet, Neutral Janet and all four of her castmates’ human characters, each of whom took on the physical appearance of Janet while hiding out in her void (it’s a long story). “D’Arcy is an unbelievable improvisational actor, and she has incredible range,” Schur said. “It was like: We should turn her loose.”

To watch Carden play six characters in just one episode is to see 20 years of training compressed into 22 minutes of unassailable technique. “If this had come my way 10 years ago, it would have been a different story,” she says. But after spending “zillions of hours” training at UCB, when “The Good Place” and “Barry” came along, “I didn’t feel unprepared. It was this great feeling of: I’ve got this.”

“She’s popping off so hard because she’s been training for this,” Glazer said. “She’s been ready for this moment. It’s going to get orders of magnitude bigger than this. This is just the beginning for D’Arcy.”

Carden’s worried about sounding “cheesy” or “like I’m bragging” when discussing her good fortune, but if she’s being honest, she has to admit it: “Yes, I am totally living my dream.”

I watched 11 episodes of Lizzie McGuire in one sitting on Disney Plus. Here’s why I couldn’t stop — even though I’m 28.

The hairstyles and patterned pants just don’t get old.

Before you binge ‘Queer Eye: We’re in Japan!,’ meet Naomi Watanabe, one of the country’s biggest stars

Watanabe talked to us about how she’s ‘over being fat,’ which member of the Fab Five she stays in touch with, and more