# OpenAI API Call Not Running with " when formatted as json safe

**URL:** <https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010>\
**Category:** Need help\
**Created:** [April 10, 2024, 4:08am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010 "2024-04-10T04:08:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rohan2/32/200944_2.png) [@rohan2](https://forum.bubble.io/u/rohan2)\
**Post date:** [April 10, 2024, 4:08am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/1 "2024-04-10T04:08:01Z")

</div>

![Screenshot 2024-04-10 at 11.03.56 am](https://us1.discourse-cdn.com/bubble/original/3X/7/b/7bdb383dc24cef6b8f1e9f141cdde841edd1db64.png)

I’m setting the input value to formatted as json safe but it’s still not running if quotation marks (") are in the input.

I’ve looked at the other answers but can’t work it out. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![christo1](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@christo1](https://forum.bubble.io/u/christo1)\
**Post date:** [April 10, 2024, 11:02pm UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/2 "2024-04-10T23:02:31Z")

</div>

What does your API call setup look like?

---

<div class="post-metadata">

**Author:** ![rohan2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rohan2/32/200944_2.png) [@rohan2](https://forum.bubble.io/u/rohan2)\
**Post date:** [April 11, 2024, 2:18am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/3 "2024-04-11T02:18:42Z")

</div>

Is this what you need @christo1 ?

 ![Screenshot 2024-04-11 at 9.17.25 am](https://us1.discourse-cdn.com/bubble/original/3X/b/c/bc9c2046458096f3ea421448489f1d605df58109.png)

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [April 11, 2024, 2:22am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/4 "2024-04-11T02:22:51Z")

</div>

You cannot use encode as json-safe on a part of the value. All the value need to be encoded as json-safe because this function add doubles quotes around the whole string. So remove all the content value including double quotes, put this in arbitrary text, fill the placeholder with dynamic text, and apply the format as json on the arbitrary text, not on each part. You can probably remove \n and replace them by real newline

---

<div class="post-metadata">

**Author:** ![christo1](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@christo1](https://forum.bubble.io/u/christo1)\
**Post date:** [April 11, 2024, 2:35am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/5 "2024-04-11T02:35:02Z")

</div>

As Jici said. What I would do is Multiline Guest Review’s Value.Find and replace

Then find " and replace with a space. It will fix it if they use ". You can find and replace any other characters that break the API as well this way without having to redo it all. JSON safe does capture more issues but will require more work to implement if you’re in a hurry. For me " always breaks things, so is the most common issue you’ll encounter.

---

<div class="post-metadata">

**Author:** ![rohan2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rohan2/32/200944_2.png) [@rohan2](https://forum.bubble.io/u/rohan2)\
**Post date:** [April 11, 2024, 5:16am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/6 "2024-04-11T05:16:59Z")

</div>

Thanks everyone. Find and replace was easy enough to implement and fix the issue

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [April 11, 2024, 12:33pm UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/7 "2024-04-11T12:33:42Z")

</div>

But like @christo1 said, you could face some issues with other characters that must be encoded + you are loosing some key information by removing all the double quotes from the string (but this depend of what you are doin with the content…). Honestly, you should use the right function for this kind of case, and for that, it’s encoded as json-safe.

---

<div class="post-metadata">

**Author:** ![rohan2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rohan2/32/200944_2.png) [@rohan2](https://forum.bubble.io/u/rohan2)\
**Post date:** [April 12, 2024, 4:09am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/8 "2024-04-12T04:09:03Z")

</div>

Thank you. Could you please help me understand what is the “right function” I should be using?

I know the find and replace is work around. Can you help?

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [April 12, 2024, 12:02pm UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/9 "2024-04-12T12:02:04Z")

</div>

> [@Jici](#):
>
> o remove all the content value including double quotes, put this in arbitrary text, fill the placeholder with dynamic text, and apply the format as json-safe on the arbitrary text, not on each part.

It’s all in my previous post. :formatted as json-safe is the function, but you need to do a little more work on that by moving all the value to the arbitrary text first.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [June 19, 2024, 4:08am UTC](https://forum.bubble.io/t/openai-api-call-not-running-with-when-formatted-as-json-safe/317010/10 "2024-06-19T04:08:58Z")

</div>

Closed on June 19, 2024, 4:08am UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
