JSFiddle - React, Tailwind, and code Playground

JavaScript

var xhr = new XMLHttpRequest();
xhr.responseType = "json";

xhr.open("POST", "/echo/json/");
xhr.send("hello world");

xhr.onload = function() {
    console.log(xhr.response);
    console.log(xhr.responseText);
}