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

138
Views
How to find JSON data based on what else is in the JSON object when duplicates exist?

I'm currently working on some data chart implementation on a website, and I have a JSON with some data, notably some ID numbers, some dates, and some datapoints. Because I have multiple dates under the same ID, I'm looking for a way to do what is essentially "Find the JSON object that has this ID and Month, then get the datapoint numbers from that object". Any help on how I would accomplish this? Preferably without iteration, if possible, as the file is extremely large. I'll include an example of what the JSON looks like:

[{
"ID" : "32",
"month" : "6",
"value" : "438"
},
{
"ID" : "32",
"month" : "5",
"value" : "223"
}

It should also be noted that the ID's aren't grouped together like this in the actual json, this is just an example. Also changing the json contents is not an option.

Any help is greatly appreciated, thank you!

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

0

In JS you could use array.find.

Something like res = myArray.find(item => item["ID"] === "32" && item["month"] === "5").

Then res is the object your searching for.


If you want to accomplish lookups without any iteration you'd need to generate a data structure with unique keys, ie. make a new object with keys something like id-month.

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!