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

314
Views
Angular 2, split data from Json

Hi I have a json from http request, the server json response is this:

{
  "map": {
    "03/04": 13,
    "05/04": 41,
    "06/04": 1,
    "12/04": 4,
    "14/04": 7,
    "18/04": 8,
    "19/04": 2,
    "22/04": 1,
    "25/04": 4
  },
  "links": []
}

I want to split dates in 1 array and values in other array, At the end I want : Data[03/04,05/04,06/04....] and Val[13,41,1....] is it possible without difficult implementation?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

This could be an approach:

   private Data = [];
   private Val = [];
   for (let key in data) {
      this.Data.push(key);
      this.Val.push(data[key])
   }
over 4 years ago · Santiago Trujillo Report

0

you can use this

  var a=`{
          "map": {
            "03/04": 13,
            "05/04": 41,
            "06/04": 1,
            "12/04": 4,
            "14/04": 7,
            "18/04": 8,
            "19/04": 2,
            "22/04": 1,
            "25/04": 4
          },
          "links": []
        }`

        var Data=[];
        var val=[]
        for(each in a.map){
            Data.push(each);
            val.push(a.map[each]);
        }
over 4 years ago · Santiago Trujillo Report

0

let date = Object.keys(JsonRespond.map) // get all keys in map object
let value = [];
date.forEach((key) => {
   value.push(JsonRespond.map[key]);
})
over 4 years ago · Santiago Trujillo 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!