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

378
Views
diccionario de codificación cbor con clave(s) int gire a clave(s) de cadena en el lado del servidor
# client side code: import {encode, decode} from "cbor-js" const data = {1: 1, 2: 2, 3: :3} const encoding = encode(data)

después de enviar los datos codificados al servidor (python) y decodificarlos, estoy recibiendo:

 data = {"1": 1, "2": 2, "3": 3}

en vez de :

 data = {1:1, 2:2, 3:3}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

mi solución fue modificar cbor-js lib para que también maneje un tipo de Map

función encodeItem:

 else if (value instanceof Map){ var keys = Array.from(value.keys()); length = keys.length; writeTypeAndLength(5, length); for (i = 0; i < length; ++i) { var key = keys[i]; encodeItem(key); encodeItem(value.get(key)); } }

adición decodeItem:

 case 5: function isStringType(val) { return typeof val === "string" } var retObject = new Map(); for (i = 0; i < length || length < 0 && !readBreak(); ++i) { var key = decodeItem(); retObject.set(key, decodeItem()) } const allKeysAreStrings = Array.from(retObject.keys()).every(isStringType) if (allKeysAreStrings){ retObject = Object.fromEntries(retObject) } return retObject;
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!