Can't figure out syntax error with JSON body

I am using an backend workflow to pass JSON to another backend workflow (api). My api initializes fine using a sample JSON body, but when I use the exact same JSON body live in my app I get the following error:

Workflow error - The service My API - Parse Themes just returned an error (HTTP 400). Please consult their documentation to ensure your call is setup properly. Raw error: Error: Error parsing request body: Unexpected token \ in JSON at position 1

I can’t seem to figure this out because I don’t know where the "token " is coming from. Anyone know what’s going on?
Screenshot 2024-05-30 at 11.36.48 AM

What campaigns thematic is returning? What is your API Connector settings? please share screenshot

campaigns Thematic Analysis API Response’s message content is:


 {   "CampaignID": "1716496151840x264182694295896060",   "Campaign Themes": ["Adaptability", "Strength", "Versatility", "Intelligence", "Majestic"],   "Responses": [     {       "ID": "1716496153935x907993721071857800",       "Theme": "Adaptability"     },     {       "ID": "1716496154524x795362326319740400",       "Theme": "Versatility"     },     {       "ID": "1716496154910x888573813615670700",       "Theme": "Intelligence"     },     {       "ID": "1716496155082x596180361478138500",       "Theme": "Adaptability"     },     {       "ID": "1716496155215x568564088535110200",       "Theme": "Versatility"     },     {       "ID": "1716496155251x260862900478594720",       "Theme": "Intelligence"     },     {       "ID": "1716496155543x113530926531766110",       "Theme": "Strength"     },     {       "ID": "1716496155568x562181296907025500",       "Theme": "Versatility"     },     {       "ID": "1716496156001x530634241333298940",       "Theme": "Majestic"     },     {       "ID": "1716496156065x529431252598460160",       "Theme": "Adaptability"     },     {       "ID": "1716496156106x217273920313721950",       "Theme": "Intelligence"     },     {       "ID": "1716496156373x872626008343564400",       "Theme": "Versatility"     },     {       "ID": "1716496156604x826439713289641200",       "Theme": "Adaptability"     },     {       "ID": "1716496156643x459963731542379460",       "Theme": "Strength"     },     {       "ID": "1716496156714x165633784258746300",       "Theme": "Majestic"     },     {       "ID": "1716496156715x666282320659945500",       "Theme": "Adaptability"     },     {       "ID": "1716496156747x383261286817440100",       "Theme": "Versatility"     },     {       "ID": "1716496156846x192845303254934880",       "Theme": "Strength"     },     {       "ID": "1716496156970x683266578398125300",       "Theme": "Intelligence"     },     {       "ID": "1716496156981x414775077139036160",       "Theme": "Strength"     },     {       "ID": "1716496157081x506386982432673000",       "Theme": "Versatility"     },     {       "ID": "1716496157095x495688657064787600",       "Theme": "Adaptability"     },     {       "ID": "1716496157255x556908911673973800",       "Theme": "Resilience"     },     {       "ID": "1716496157322x258240445025945200",       "Theme": "Versatility"     },     {       "ID": "1716496157352x802478642662177000",       "Theme": "Resilience"     },     {       "ID": "1716496157553x794141156041773000",       "Theme": "Adaptability"     },     {       "ID": "1716496157559x788471781353349500",       "Theme": "Versatility"     },     {       "ID": "1716496157639x351417656057768640",       "Theme": "Adaptability"     },     {       "ID": "1716496157755x142714853752808670",       "Theme": "Intelligence"     },     {       "ID": "1716496157829x232017295093506880",       "Theme": "Adaptability"     },     {       "ID": "1716496157865x962209089023917400",       "Theme": "Adaptability"     },     {       "ID": "1716496157868x973351184659197200",       "Theme": "Versatility"     },     {       "ID": "1716496157874x243986273833480160",       "Theme": "Majestic"     },     {       "ID": "1716496157905x959634566040604500",       "Theme": "Adaptability"     },     {       "ID": "1716496157936x685707117667077900",       "Theme": "Versatility"     },     {       "ID": "1716496157999x598747111164678700",       "Theme": "Majestic"     },     {       "ID": "1716496157999x703075327772918700",       "Theme": "Intelligence"     },     {       "ID": "1716496158053x299761278595347650",       "Theme": "Strength"     },     {       "ID": "1716496158076x522126531177726140",       "Theme": "Adaptability"     },     {       "ID": "1716496158130x209105999291992350",       "Theme": "Versatility"     },     {       "ID": "1716496158182x231011624970383740",       "Theme": "Adaptability"     },     {       "ID": "1716496158185x301414178652122500",       "Theme": "Strength"     },     {       "ID": "1716496158219x305008095479081000",       "Theme": "Majestic"     },     {       "ID": "1716496158423x679196783930191100",       "Theme": "Adaptability"     },     {       "ID": "1716496158454x992817057443155200",       "Theme": "Strength"     },     {       "ID": "1716496158554x274396434705815420",       "Theme": "Adaptability"     },     {       "ID": "1716496158565x187326419841735260",       "Theme": "Versatility"     },     {       "ID": "1716496158569x259128465582809700",       "Theme": "Majestic"     },     {       "ID": "1716496158600x551061550245638400",       "Theme": "Adaptability"     },     {       "ID": "1716496158706x531540811719617400",       "Theme": "Adaptability"     },     {       "ID": "1716496158769x782770736073464800",       "Theme": "Versatility"     },     {       "ID": "1716496158813x482426836363609900",       "Theme": "Versatility"     },     {       "ID": "1716496158818x775770619908634200",       "Theme": "Strength"     },     {       "ID": "1716496158878x180836615673066300",       "Theme": "Adaptability"     },     {       "ID": "1716496158895x464972431913646800",       "Theme": "Adaptability"     },     {       "ID": "1716496158904x513787960432946940",       "Theme": "Versatility"     },     {       "ID": "1716496158920x502870012660258300",       "Theme": "Adaptability"     },     {       "ID": "1716496159046x379226500355572350",       "Theme": "Versatility"     },     {       "ID": "1716496159061x817318555622224300",       "Theme": "Strength"     },     {       "ID": "1716496159094x169918714598662480",       "Theme": "Adaptability"     },     {       "ID": "1716496159188x860599262932986200",       "Theme": "Adaptability"     },     {       "ID": "1716496159375x452188682650234200",       "Theme": "Strength"     },     {       "ID": "1716496159680x961105862897275700",       "Theme": "Adaptability"     },     {       "ID": "1716496159681x491414869483104200",       "Theme": "Majestic"     },     {       "ID": "1716496159747x178659981177776700",       "Theme": "Versatility"     },     {       "ID": "1716496159814x733516718561100000",       "Theme": "Adaptability"     },     {       "ID": "1716496159858x401869564632973300",       "Theme": "Versatility"     },     {       "ID": "1716496159880x370666269736727100",       "Theme": "Strength"     },     {       "ID": "1716496159896x307451193320541700",       "Theme": "Versatility"     },     {       "ID": "1716496159937x695543127229624800",       "Theme": "Strength"     },     {       "ID": "1716496159943x300729230242069440",       "Theme": "Majestic"     },     {       "ID": "1716496160027x160583391383996480",       "Theme": "Versatility"     },     {       "ID": "1716496160179x117639763656431020",       "Theme": "Adaptability"     },     {       "ID": "1716496160222x454615486454250000",       "Theme": "Versatility"     },     {       "ID": "1716496160241x517696700351744960",       "Theme": "Versatility"     },     {       "ID": "1716496160319x275517212708773730",       "Theme": "Strength"     },     {       "ID": "1716496160419x740323532253747200",       "Theme": "Adaptability"     },     {       "ID": "1716496160421x467188093409456800",       "Theme": "Adaptability"     },     {       "ID": "1716496160522x876338332573536800",       "Theme": "Intelligence"     },     {       "ID": "1716496160539x845863490924970200",       "Theme": "Versatility"     },     {       "ID": "1716496160679x245893133363222180",       "Theme": "Adaptability"     },     {       "ID": "1716496160696x813561736711628300",       "Theme": "Strength"     },     {       "ID": "1716496160702x976616822600028900",       "Theme": "Adaptability"     },     {       "ID": "1716496160744x710628735551023000",       "Theme": "Adaptability"     },     {       "ID": "1716496160745x728054114605646100",       "Theme": "Adaptability"     },     {       "ID": "1716496160746x517780724147096200",       "Theme": "Majestic"     },     {       "ID": "1716496160799x456852253900881200",       "Theme": "Intelligence"     },     {       "ID": "1716496160882x607182420853531900",       "Theme": "Adaptability"     },     {       "ID": "1716496160913x263942247620291070",       "Theme": "Majestic"     },     {       "ID": "1716496160977x908830941728063700",       "Theme": "Strength"     },     {       "ID": "1716496161082x741980810734941700",       "Theme": "Strength"     },     {       "ID": "1716496161154x358866650984355460",       "Theme": "Intelligence"     },     {       "ID": "1716496161190x796012997645663700",       "Theme": "Versatility"     },     {       "ID": "1716496161250x453014879221586240",       "Theme": "Strength"     },     {       "ID": "1716496161380x360366753045804300",       "Theme": "Versatility"     },     {       "ID": "1716496161607x392510739421504830",       "Theme": "Majestic"     },     {       "ID": "1716496161636x515844024104110640",       "Theme": "Intelligence"     },     {       "ID": "1716496161852x479460505930651600",       "Theme": "Strength"     }   ] }

Could it be something wrong with the commas in the alt-svc line?

I mean quotes**

If double quotes are like in your quotes… this is an issue. But I guess this only happen because you copy past it here not using ``` around your JSON text like

json

Also, did you copy the one you have in API Connector you used to iniatialize your call? It’s worth nothing. What we need to the real data you are sending when you get this error. Also, why to use trimmed?

Thanks for your help. I used trimmed just in case it was something related to extra spaces but that hasn’t had an effect. It is the same as the initialization but I used real data for the initialization and this is copied from the logs, I just can’t take an image of the whole thing:

Is there a way to see the entire API call? In the advanced options in the logs I can just see the HTTP request and response but that doesn’t actually give me the whole request.

Why do you have (body) body: in there?

Were you told you needed it in there?

I always suggest running your JSON through a validator.

I’d try taking out the (body) body: because I think it’s causing a problem with the brackets starting out.

I think that’s just because my dynamic data is labeled “body”? At least that’s my understanding. I’m not sure how I would change that.
image

hey @lmathews2010 :wave:

I think this might be related to the whole json as being a parameter. Can you paste the json in the first post to the body (like to the textbox where you put <body>) and try the api call without any dynamic values?

I have tested to put all body as parameter to one of my POST calls and it didn’t work out even though it normally works when the dynamic values are just one value. (it works, see my last message.)

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

At some point this body worked, but then I couldn’t reproduce it. Maybe it’s because of the returns and spaces?

 { "CampaignID" : "1716438525093x883223546085244900", "Campaign Themes" : ["Adaptability", "Strength and Power", "Majesty", "Versatility", "Specialized Skills"], "Responses" : [{"ID" : "1716438526528x827198132489288300", "Theme" : "Versatility"},{"ID" : "1716438526650x717211303020848500", "Theme" : "Specialized Skills"},{"ID" : "1716438526662x543975063646626940", "Theme" : "Strength and Power"},{"ID" : "1716438526667x469362596314650600", "Theme" : "Versatility"},{"ID" : "1716438526785x420120229812892740", "Theme" : "Versatility"},{"ID" : "1716438526952x962591634240535400", "Theme" : "Versatility"},{"ID" : "1716438527196x774906067684581600", "Theme" : "Versatility"},{"ID" : "1716438527258x738470955620741900", "Theme" : "Strength and Power"},{"ID" : "1716438527462x128909807793376800", "Theme" : "Adaptability"},{"ID" : "1716438527550x611861556040569900", "Theme" : "Adaptability"},{"ID" : "1716438527646x346431306427361640", "Theme" : "Adaptability"},{"ID" : "1716438527652x197011847913797000", "Theme" : "Adaptability"},{"ID" : "1716438527798x502929381030088100", "Theme" : "Adaptability"},{"ID" : "1716438527821x292609679604708000", "Theme" : "Adaptability"},{"ID" : "1716438527877x231290546061001950", "Theme" : "Adaptability"},{"ID" : "1716438527953x946104490727079700", "Theme" : "Versatility"},{"ID" : "1716438527963x841210401573382400", "Theme" : "Strength and Power"},{"ID" : "1716438527989x444772075696777900", "Theme" : "Adaptability"},{"ID" : "1716438528232x882657578523251700", "Theme" : "Versatility"},{"ID" : "1716438528236x259829164951277200", "Theme" : "Adaptability"},{"ID" : "1716438528334x273906712038382700", "Theme" : "Versatility"},{"ID" : "1716438528351x787977624962745100", "Theme" : "Versatility"},{"ID" : "1716438528477x199447932915322040", "Theme" : "Adaptability"},{"ID" : "1716438528622x636502765663286900", "Theme" : "Adaptability"},{"ID" : "1716438528659x565656386967901000", "Theme" : "Majesty"},{"ID" : "1716438528669x936362271858275000", "Theme" : "Adaptability"},{"ID" : "1716438528705x868911870189982100", "Theme" : "Adaptability"},{"ID" : "1716438528706x759506273867455000", "Theme" : "Adaptability"},{"ID" : "1716438528738x455958107124976300", "Theme" : "Strength and Power"},{"ID" : "1716438528819x648263838347176800", "Theme" : "Adaptability"},{"ID" : "1716438528845x604585377019544200", "Theme" : "Majesty"},{"ID" : "1716438528877x910183419296822100", "Theme" : "Versatility"},{"ID" : "1716438528912x110544361997371160", "Theme" : "Versatility"},{"ID" : "1716438528966x526739534527035600", "Theme" : "Adaptability"},{"ID" : "1716438528968x554674450248513500", "Theme" : "Adaptability"},{"ID" : "1716438528977x619565528307886000", "Theme" : "Versatility"},{"ID" : "1716438529039x896625457692181900", "Theme" : "Versatility"},{"ID" : "1716438529100x157100048919855520", "Theme" : "Adaptability"},{"ID" : "1716438529100x736325504800005900", "Theme" : "Adaptability"},{"ID" : "1716438529122x847247292797753900", "Theme" : "Adaptability"},{"ID" : "1716438529136x479252167993977400", "Theme" : "Majesty"},{"ID" : "1716438529218x465769347376132600", "Theme" : "Adaptability"},{"ID" : "1716438529232x522084583657406200", "Theme" : "Adaptability"},{"ID" : "1716438529252x490109872776007800", "Theme" : "Adaptability"},{"ID" : "1716438529327x834589238142896800", "Theme" : "Specialized Skills"},{"ID" : "1716438529438x119486033101001700", "Theme" : "Versatility"},{"ID" : "1716438529462x924800267771960800", "Theme" : "Versatility"},{"ID" : "1716438529496x531812773068972540", "Theme" : "Adaptability"},{"ID" : "1716438529651x803277688904102900", "Theme" : "Adaptability"},{"ID" : "1716438529691x306171551959936640", "Theme" : "Strength and Power"},{"ID" : "1716438529712x649640510060465400", "Theme" : "Adaptability"},{"ID" : "1716438529732x781139127138324600", "Theme" : "Majesty"},{"ID" : "1716438529824x905723428495692900", "Theme" : "Adaptability"},{"ID" : "1716438529899x738394130749697000", "Theme" : "Adaptability"},{"ID" : "1716438529934x890472092408956400", "Theme" : "Strength and Power"},{"ID" : "1716438530008x651129875693636100", "Theme" : "Adaptability"},{"ID" : "1716438530021x685481499871473500", "Theme" : "Adaptability"},{"ID" : "1716438530058x498326567218877250", "Theme" : "Versatility"},{"ID" : "1716438530115x242764343156291140", "Theme" : "Adaptability"},{"ID" : "1716438530118x980061072954974000", "Theme" : "Strength and Power"},{"ID" : "1716438530135x903108328693504600", "Theme" : "Versatility"},{"ID" : "1716438530216x275012020729120900", "Theme" : "Adaptability"},{"ID" : "1716438530412x275014883840377400", "Theme" : "Adaptability"},{"ID" : "1716438530412x904742609685687800", "Theme" : "Adaptability"},{"ID" : "1716438530435x414845446899171600", "Theme" : "Versatility"},{"ID" : "1716438530534x472119404242482300", "Theme" : "Adaptability"},{"ID" : "1716438530644x697284962130294500", "Theme" : "Adaptability"},{"ID" : "1716438530681x677133905106945200", "Theme" : "Adaptability"},{"ID" : "1716438530686x838801525517855100", "Theme" : "Adaptability"},{"ID" : "1716438530695x239700565828389500", "Theme" : "Versatility"},{"ID" : "1716438530919x960348621725754900", "Theme" : "Versatility"},{"ID" : "1716438531060x102568784461156910", "Theme" : "Adaptability"},{"ID" : "1716438531292x921944606471840900", "Theme" : "Specialized Skills"},{"ID" : "1716438533237x994808621090221800", "Theme" : "Adaptability"}]}

Or the IDs might have been updated since your last call? But in any case, I think this might be related to the big JSON chunk as one single dynamic value. (it is not, see my next message.)

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

You know what. Forget what I said. It looks like it is working, one big chunk as JSON dynamic value:
image

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

Actually, I think you were right? This was my first API I’ve set up to my own app so I had just read on another thread to do the dynamic value. I didn’t realize if you just leave the body as is Bubble let’s you edit the body when you call the API :man_facepalming:

It seems to be working now! I’ll have to do some more testing but so far so good. Thanks!
image

Alright. Glad I helped even if I didn’t necessarily find the problem :slight_smile:

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble