-1

In JS (it is node/js but actually is a general JS question)

I have a data object which is a result of JSON coming from the server.

I want to manipulate the data before passing it to the view.

How can I do that? (I can make additional objects that contain the rest of the data but it feels wrong and un-natural)

var response = JSON.parse(moment_respose_content );
if (response.success)
{
    var data = response.data[0];
    //add additional fields to data
}
Boaz
  • 4,864
  • 12
  • 50
  • 90

1 Answers1

0

This may have already been answered

A JSON object is just a JS object, you can add/edit/remove parts like you would any other.

Community
  • 1
  • 1
evolutionxbox
  • 3,932
  • 6
  • 34
  • 51