0
//response = [{"id":"1","created":"26-05-2016"},{"id":"2","created":"25-05-2016"},{"id":"8","created":"21-05-2016"}]

success : function(response){
var obj = JSON.parse(response);

// here i want to make associative array... like array['user'] = id & array['created']..

please help me

2
  • Your code should have already achieved it. Commented May 27, 2016 at 9:53
  • For example, to get "created" in id "1", use obj[0]["created"]; Commented May 27, 2016 at 9:54

1 Answer 1

2

simply try this

    var response = [{"id":"1","created":"26-05-2016"},{"id":"2","created":"25-05-2016"},{"id":"8","created":"21-05-2016"}];
    var output = response.map(function(obj){ return { user: obj.id, created: obj.created } })
    
    console.log(output)

Sign up to request clarification or add additional context in comments.

1 Comment

@MuhammadWakeel try the demo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.