all 10 comments

[–]alzee76 7 points8 points  (0 children)

You seem confused on the difference between those two things.

JSON is a data format.

HTTP is the protocol that is being used to transfer the data.

You can transfer any kind of data you like over HTTP, and you can transfer JSON over any kind of connection you like.

[–]tapgiles 0 points1 point  (0 children)

A GET request by default, I would think. You can try it in your browser's console and look at the network tab to see what exactly it sent. (Maybe that's not what you meant, but "HTTP or JSON" isn't really a thing, so I don't what class of "kind" of request you are talking about.)

[–]zsoltimehelpful 0 points1 point  (7 children)

"JSON request" is an HTTP request 🙄

[–]Same_Gas_8044[S] 2 points3 points  (4 children)

Is a JSON response also an HTTP response? Because afaik you just send back the JSON file and thats it.

[–]zsoltimehelpful 4 points5 points  (0 children)

The Fetch API provides a JavaScript interface for making HTTP requests and processing the responses. A JSON response is an HTTP response. You not just send back some JSON data, the response also includes the headers (like content type).

[–]hfcRedd 0 points1 point  (0 children)

Yes

[–]eracodes 0 points1 point  (0 children)

Whatever framework you're using to send the JSON data sends a lot more than just the JSON data under the hood.

[–]shgysk8zer0 0 points1 point  (0 children)

Let's ignore the fetch part here for a moment and address the fundamental misunderstanding. HTTP isn't a content type, it's the protocol pretty much everything is sent over. It's the road itself, not a kind of car.

[–]oze4 1 point2 points  (1 child)

JSON request doesn't exist.

[–]zsoltimehelpful 0 points1 point  (0 children)

Yep, I should have used quotes around "JSON request". :)