Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
ERROR: invalid character ' ' in literal true (expecting 'e') - POST API JSON

I am trying to use the POST method to insert some data from a person with JSON. I am using the code from JS to construct, but when i start the transformation, it sends me "ERROR: invalid character ' ' in literal true (expecting 'e')". Does anyone know how to solve it?

const obj = {
  "num_matricula": num_matricula,
  "limit_date": "2022-05-20",
  "admission_date": admission_date,
  "cost_center": cost_center,
  "pos_number": pos_number,
  "role": role,
  "department": department,
  "pagamento": {
    "vinculo": vinculo,
    "valor": valor,
    "recorrencia": recorrencia,
    "contaBancaria": {
      "banco": "001",
      "carta": "c9160763-db6c-4e8c-a1ad-ad8709c99be2"
    }
  },
  "deficiencia": deficiencia,
  "jornada": jornada,
  "profile": {
    "name": name,
    "email": email,
    "mobile": mobile
  },
  "exame": {
    "clinica": "6dc84ce4-7d9f-48ec-b9b1-a8a895a21fd4",
    "data": "2022-05-15",
    "hora": "14:00",
    "obs": "Comparecer de manhã",
    "guia": "e37dab24-c7a4-4b92-b9d1-32ed538b8300",
  },
  "docs": ["c9e26093-5e0c-4bd2-bea3-ac5182a6179f"],
  "send_sms": true,
  "send_email": true
};
const myJSON = JSON.stringify(obj);

Some columns are already provided with data from previous step (you can see in the images below), that is why i just repeated the column name in the JS code. Just to let you know, the boolean types of data are the columns: send_email, send_sms and deficiencia.

enter image description here enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is that JSON is a string. So in your first line you see this is not valid json: "num_matricula": num_matricula,

only numbers can be without double quotes: "num_matricula": 1234,

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!