Convert a JSON POST to Fetch
Input
curl https://example.test/api -H 'Content-Type: application/json' -d '{"enabled":true,"value":null}'Example output
// Generated JavaScript (fetch) code from cURL
// Target: POST https://example.test/api
const response = await fetch("https://example.test/api", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"enabled": true,
"value": null
}),
});
const data = await response.json();
console.log(data);