# JSONDecodeError when trying to use Roboflow Model with Webcam

**URL:** <https://discuss.roboflow.com/t/jsondecodeerror-when-trying-to-use-roboflow-model-with-webcam/6508>\
**Category:** 🤝  Community Help\
**Created:** [July 13, 2024, 12:25pm UTC](https://discuss.roboflow.com/t/jsondecodeerror-when-trying-to-use-roboflow-model-with-webcam/6508 "2024-07-13T12:25:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mila\_Castillo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mila_castillo/32/5089_2.png) [@Mila\_Castillo](https://discuss.roboflow.com/u/Mila_Castillo)\
**Post date:** [July 13, 2024, 12:25pm UTC](https://discuss.roboflow.com/t/jsondecodeerror-when-trying-to-use-roboflow-model-with-webcam/6508/1 "2024-07-13T12:25:01Z")

</div>

Hello! I have a small problem here, if anyone could help. I have been trying to use a Roboflow Model for live Object Detection using a webcam and some python code, and it is my first time working on such a project, so it is taking some time to understand everything.

I trained my dataset using the Google Colab for yolov8 (Model Type: yolov8s Model Upload). However, when infering the frames, I need to extract the position of the bounding box and its confidence, at best using JSON, however I keep getting JSONDecodeError (raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)  
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0))

From this I take that my response is not decodable to JSON, but why? It seems to work for other people, as I have seen online. I have not found an answer to this problem online.

I have found the most common method to infer the frames is using the upload link to the Roboflow Inference API, so I found this code and copied it. I have seen that on the website, theres an Option to have the result as an image or as JSON, is there a way to specify this in python maybe?

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/c/cfa973e1e5d532ea81b61bc1406e6bbfbf1a9b7b.png)

What I find weird, is that the response status is 200, but the raw response would be something like this: \<urllib3.response.HTTPResponse object at 0x0000019865274D60\>. What does this mean?

Hopefully I have described the situation well enough, if there is any necessary info needed please ask.

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [July 15, 2024, 6:45pm UTC](https://discuss.roboflow.com/t/jsondecodeerror-when-trying-to-use-roboflow-model-with-webcam/6508/2 "2024-07-15T18:45:14Z")

</div>

Hey @Mila_Castillo

Our hosted inference API has two return formats, specified in the `format` query parameter: `image` and `json`, where JSON is the default.

In your query URL, you specify an image return format that returns an image (not readable JSON) with annotated predictions as a binary blob. If you’re looking for JSON, you should either remove the “&format=image” from your URL, which will make it default to JSON, or specify `format=json`.

Hope this helps

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/bb6edbfa56d0cf2ee603f061e9e09103502cc8cc.png) [@system](https://discuss.roboflow.com/u/system)\
**Post date:** [July 22, 2024, 6:46pm UTC](https://discuss.roboflow.com/t/jsondecodeerror-when-trying-to-use-roboflow-model-with-webcam/6508/3 "2024-07-22T18:46:05Z")

</div>

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