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

241
Views
How do I convert a Nest request object with a buffer into JSON?

How do I convert a Nest request object with a buffer into JSON? Everything I've logged either shows an array of bytes or a string.

Here is my controller:

export class KycresultsController {
  @Post()
  create(@Body() data: any): string {
    const j = data.toJSON();

    var buf = Buffer.from(JSON.stringify(data));
    var temp = JSON.parse(buf.toString());
    var f = temp.data;
    console.log(f);

    const decodedJsonObject = Buffer.from(f, 'base64').toString('ascii'); 
    console.log(decodedJsonObject);`

And I send this POST:

curl -X POST localhost:3001/kycresults -d "emsample=1&data=2"

I see in my logs:

[
  101, 109, 115, 97, 109, 112,
  108, 101,  61, 49,  38, 100,
   97, 116,  97, 61,  50
]
emsample=1&data=2
[
  101, 109, 115, 97, 109, 112,
  108, 101,  61, 49,  38, 100,
   97, 116,  97, 61,  50
]
emsample=1&data=2

I want to get {emsample: 1, data: 2}

about 4 years ago · Juan Pablo Isaza
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!