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

210
Views
How do I access values of a JSON object extracted from quick.db?

I'm trying to access values from a JSON object, however, its formatting won't allow me to use the traditional methods of doing so. For example the formatting would be as follows:

{
  "123456789" : 0
  "12345678910" : 14
}

How would I be able to access the name and the value of the first field? ex. 123456789 and 14. I'ved tried to stringify the objects and just treat it as a regular string and finding the first instance of " and last instance of " to get the name and then finding the index of : and adding 1 to get the value. However, I don't think it would be efficient neither fully accurate. Is there a way to convert this JSON Object to a 2D Array? to access it more easily?

EDIT: I won't actually know the IDs stored in the JSON Object, they are randomly generated, which is why I've stated my previous solutions before and I won't be able to use traditional methods. So I need to find a way to grab the name and value without actually knowing them. Which is why storing a JSON object in a 2D array would be most useful but I need to know if it's possible

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

0

Using JSON.parse which parses a JSON string, constructing the JavaScript value or object described by the string passed to to it

In case you don't know the keys a head you can use the Object.keys method to get the object keys.

const data = JSON.parse('{"123456789": 0, "12345678910": 14}');

console.log(data[12345678910]);
console.log(data[123456789]);
 
// in case you don't know the keys a head
const keys = Object.keys(data);

console.log(data[keys[0]]);
console.log(data[keys[1]]);

More about JSON.parse in this link

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!