Problems Parsing JSON using REST API and fetch

I’m using this code

fetch("", {
    method: 'POST',
    headers: {
      'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246",
      Accept: "application/vnd.github.v3.raw+json",
      Authorization: "token 1234567890"
    body: {
      title: "Automatic Error Report",
      body: b

where b is a markdown string. however I get an error 400 and the message Problems parsing JSON. What am I missing?

Never mind forgot to JSON.stringify the body

1 Like