Hi, I’m trying to call an API that generates stories, and it returns a big chunk of text in a JSON file. So far I’ve managed to get that contents of the JSON logged through the script attached in the screenshot below. This is what I get when I call the script:
{“story_request”:{“language”:“English”,“characters”:“frank,carla,and tim”,“antagonist”:“sean”,“contagonist”:“sofia”,“model”:“gpt-3.5-turbo-16k-0613”,“preamble_key”:“193a31cfac98094dee8412b5d948d377c7c87a03”,“prompt_template_key”:0.2,“temperature”:“28640f0a62bc8af8ed66d33211346ab970f04f89”},“content_id”:“cc6e8c3144cd0d6f1625f56dd528a36895f5b8e9”,“story”:“Once upon a time, in the beautiful country of Ecuador, Frank, Carla, and Tim were on a family adventure in their trusty van. They were driving through the lush rainforests of the Amazon when suddenly, the videophone rang. It was Grandpa, calling to announce that they were going on an exciting adventure!\n\n"Hey there, my little adventurers! I have a game for you," Grandpa said with a mischievous smile. "I’ll give you clues, and you have to guess our destination."\n\n"I love games! Let’s do it!" Tim exclaimed, bouncing up and down in his seat.\n\n"Alright, here’s the first clue," Grandpa said. "Our destination is known for its stunning mountains and colorful markets."\n\nCarla thought for a moment and then shouted, "I know! We’re going to Quito!"\n\n"Correct, Carla! We’re teleporting to Quito right now!" Grandpa exclaimed, and in an instant, the van was surrounded by the bustling streets of the capital city.\n\nAs they explored the vibrant city, the family stumbled upon a problem. A factory nearby was releasing thick smoke into the air, polluting the environment.\n\n"Oh no, this pollution is terrible!" Frank exclaimed, covering his nose.\n\nSacha, always eager to take charge, said, "We can’t just ignore this. We have to do something!"\n\n"But what can we do?" Oscar asked, scratching his head.\n\nSacha thought for a moment and then said, "I have an idea! Let’s gather all the people in the market and have a peaceful protest against the factory."\n\nExcitedly, the family set off to gather people and spread the word about the protest. But just as they were about to start, a sudden rainstorm poured down, scattering everyone.\n\n"Oh no, our plan is ruined!" Carla exclaimed, her face falling.\n\nBut Sacha, never one to give up, said, "Don’t worry, we can adapt our plan. Let’s find a sheltered area and continue our protest there."\n\nAs they regrouped and found a covered area, they were suddenly surprised by the appearance of Sofia, a local environmental activist.\n\n"I heard about your protest and I want to help," Sofia said, determination shining in her eyes.\n\nWith Sofia’s help, the family revised their plan. They decided to create a giant mural depicting the beauty of nature and the importance of protecting it.\n\nTogether, they worked tirelessly, painting and spreading their message. And finally, the mural was complete, capturing the attention of everyone who passed by.\n\nAs the crowd gathered around, Sofia stepped forward and said, "We must work together to protect our environment. Let’s make a promise to take care of our planet."\n\nThe crowd cheered, and the family felt a sense of triumph. They had made a difference in their own small way.\n\nJust then, Grandpa appeared on the videophone, cheering them on. "Well done, my little adventurers! You’ve shown the world the power of unity and determination."\n\nBut as the family celebrated, Grandpa revealed a surprising twist. "You know, I was the one causing the pollution in the factory. It was all part of my plan to teach you about the importance of standing up for the environment."\n\nThe family gasped in disbelief, but then burst into laughter. They realized that even though Grandpa had played the role of the antagonist, his intentions were for their own growth and understanding.\n\nAnd so, with their hearts full of love and a newfound appreciation for the environment, the family continued their adventures, ready to face any challenge that came their way.”,“title”:“Untitled”,“timestamp”:“2023-07-22T18:13:48.406349+00:00”}
How would I go about getting just the story text and making it readable? I’ve followed a bunch of tutorials on YouTube and they all end up with this chunk at the end even after I try parsing it the way they did.
Thank you!








