How to fix it: JSONError: Unexpected token 'F' at 1:1 Forbidden ^

Please help to solve the problem.
I am trying to do an independent test on editing the article. Created variables for registration and new article.
But it constantly gives an error: JSONError: Unexpected token β€˜F’ at 1:1 Forbidden ^
I don’t know what else can be fixed.
All the variables I use are in the screenshots.



Hello, did you find a mistake? I have the same but Error: Unexpected token β€˜N’ at 1:1 Not Found ^

I would probably try those post requests separately in a collection before joining them together in a pre-request script.

I suspect the problem is that one of your variables isn’t writing correctly. (Probably the token, as you are getting a forbidden message).

It would be useful to see your console log on what was actually sent. Is the token showing correctly in the request?

1 Like

JSONError: Unexpected token β€˜F’ at 1:1
Forbidden
^
: i faced the same issue : I was doing post manual basic scripts
-i just re- run token request then everything worked fine

For anyone else reading this topic, let me explain the error and what is causing it.

JSONError: Unexpected token β€˜F’ at 1:1 Forbidden ^

This is caused by having a JSON parse command somewhere in your script.

pm.response.json() or JSON.parse()

These functions are expecting a JSON format, so whatever they are targeting should either start with a [ for an array, or { for an object (an array is a special type of object, but that is a a conversation for another day).

In the above case, its not returning JSON, but a forbidden error. Therefore the first character which is an β€˜F’ in unexpected. You’ll also see errors showing β€˜H’ because a HTML response has been returned instead of the expected JSON.