# Script Error using Pre-Requests

**URL:** <https://community.postman.com/t/script-error-using-pre-requests/51475>\
**Category:** Help Hub\
**Tags:** tests, scripts\
**Created:** [September 7, 2023, 10:07am UTC](https://community.postman.com/t/script-error-using-pre-requests/51475 "2023-09-07T10:07:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anaskoualal](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@anaskoualal](https://community.postman.com/u/anaskoualal)\
**Post date:** [September 7, 2023, 10:07am UTC](https://community.postman.com/t/script-error-using-pre-requests/51475/1 "2023-09-07T10:07:12Z")

</div>

Hi, there! I’m newbie in Postman and I’m having an error i’m unable to solve. I’ve looked already for an answer but I haven’t found a topic that could help me.

I’m trying to launch a Pre-request Script in JSON but I always see the same error: “SyntaxError: Unexpected token ‘\<’”

I’m trying to download a package from an application and it’s seems not worked.

This is the code I’m trying tu run:

 ![MicrosoftTeams-image (1)](https://us1.discourse-cdn.com/getpostman/original/3X/8/c/8c2d6ae891cdf9d608ec36923dda7e12624eb8fc.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 7, 2023, 10:28am UTC](https://community.postman.com/t/script-error-using-pre-requests/51475/2 "2023-09-07T10:28:57Z")

</div>

Hey @anaskoualal 👋

Welcome to the Postman Community! :postman:

That appears to look more like a request body (I might be wrong here) than a script.

If you add that JSON to the `Body > Raw` section and choose the `JSON` option from the dropdown, does that unblock you?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/7/9/795bf20cc96c2b6fe105cd0081955906f74c1ae8.png)

---

<div class="post-metadata">

**Author:** ![anaskoualal](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@anaskoualal](https://community.postman.com/u/anaskoualal)\
**Post date:** [September 7, 2023, 12:24pm UTC](https://community.postman.com/t/script-error-using-pre-requests/51475/3 "2023-09-07T12:24:13Z")

</div>

It seems to work (the result above), I close the request, thank you very much for the answer @danny-dainton !

Just a quick question before closing: do you know where it goes when it’s ok? i.e. how do I visualize the result? do I need to create an additional script?

 ![MicrosoftTeams-image (2)](https://us1.discourse-cdn.com/getpostman/original/3X/3/6/36c41fc717e8184d0caf48e8474652b89ba06d02.png)

Thank you in advance for the reply !

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 7, 2023, 1:19pm UTC](https://community.postman.com/t/script-error-using-pre-requests/51475/4 "2023-09-07T13:19:36Z")

</div>

Glad to see you have it working! 🎉

The response from that request, would be in the `Pretty/Raw/Preview` tabs on the same line as `Visualize`. I don’t know what your response looks like to know if it _could_ be visualised.

You would need to add a seperate script (manually or using Postbot) to your `Tests` section, in order to display a visualized response.

More information on this can be found on our learning center:

> **[Visualizing responses | Postman Learning Center](https://learning.postman.com/docs/sending-requests/visualizer/)**
>
> Visualizing responses: documentation for Postman, the collaboration platform for API development. Create better APIs—faster.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [September 10, 2023, 1:20pm UTC](https://community.postman.com/t/script-error-using-pre-requests/51475/5 "2023-09-10T13:20:06Z")

</div>

Closed on September 10, 2023, 1:20pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
