Andrei Răileanu Andrei Răileanu - 1 year ago 97
Javascript Question

Manipulate JSON data into another object

I am trying to figure out how to manipulate my JSON data and create a separated object with the manipulated data.

To be more precise, I am using this JSON file:

I am trying to convert [dataset][data] into this format:


So I need to use the fields
(Date) and
(Value) and somehow put it in a new JSON formatted object but I have no idea how to do it.

Someone can help me with this situation?

$(function () {
$.getJSON('json/AAPL.json', function (data) {
// Data manipulation into a new object??

Answer Source

This should do it:

$(function () {
    $.getJSON('json/AAPL.json', function (data) {
        var correctFormat = {
            return [new Date(item[0]), item[4]];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download