A
A
Alexey Sklyarov2018-02-25 15:59:46
JavaScript
Alexey Sklyarov, 2018-02-25 15:59:46

How to discard key names from JSON object?

var json = [{"last_update":"1519556964","involvement":"1"},{"last_update":"1519557002","involvement":"1"},{"last_update":"1519557034","involvement":"1"},{"last_update":"1519557061","involvement":"1.01"},{"last_update":"1519557124","involvement":"1.01"},{"last_update":"1519557181","involvement":"1.01"},{"last_update":"1519557242","involvement":"1.01"},{"last_update":"1519557301","involvement":"1.02"},{"last_update":"1519557362","involvement":"1.03"},{"last_update":"1519557421","involvement":"1.04"},{"last_update":"1519557482","involvement":"1.05"},{"last_update":"1519557541","involvement":"1.06"},{"last_update":"1519557602","involvement":"1.07"},{"last_update":"1519557662","involvement":"1.07"},{"last_update":"1519557721","involvement":"1.07"},{"last_update":"1519557781","involvement":"1.08"},{"last_update":"1519557842","involvement":"1.09"},{"last_update":"1519557901","involvement":"1.1"},{"last_update":"1519557961","involvement":"1.11"},{"last_update":"1519558021","involvement":"1.12"},{"last_update":"1519558082","involvement":"1.13"},{"last_update":"1519558142","involvement":"1.14"},{"last_update":"1519558202","involvement":"1.15"},{"last_update":"1519558261","involvement":"1.16"},{"last_update":"1519558321","involvement":"1.17"},{"last_update":"1519558381","involvement":"1.18"},{"last_update":"1519558442","involvement":"1.19"},{"last_update":"1519558501","involvement":"1.2"},{"last_update":"1519558562","involvement":"1.21"},{"last_update":"1519558621","involvement":"1.22"},{"last_update":"1519558681","involvement":"1.23"},{"last_update":"1519558741","involvement":"1.24"},{"last_update":"1519558802","involvement":"1.25"},{"last_update":"1519558862","involvement":"1.26"},{"last_update":"1519558921","involvement":"1.27"},{"last_update":"1519558981","involvement":"1.28"},{"last_update":"1519559041","involvement":"1.29"},{"last_update":"1519559102","involvement":"1.3"},{"last_update":"1519559162","involvement":"1.31"},{"last_update":"1519559221","involvement":"1.32"},{"last_update":"1519559281","involvement":"1.33"},{"last_update":"1519559342","involvement":"1.34"},{"last_update":"1519559401","involvement":"1.34"},{"last_update":"1519559462","involvement":"1.34"},{"last_update":"1519559521","involvement":"1.34"},{"last_update":"1519559581","involvement":"1.34"},{"last_update":"1519559642","involvement":"1.34"},{"last_update":"1519559701","involvement":"1.34"},{"last_update":"1519559762","involvement":"1.34"},{"last_update":"1519559821","involvement":"1.34"},{"last_update":"1519559882","involvement":"1.34"},{"last_update":"1519559941","involvement":"1.34"},{"last_update":"1519560002","involvement":"1.34"},{"last_update":"1519560061","involvement":"1.34"},{"last_update":"1519560122","involvement":"1.34"},{"last_update":"1519560181","involvement":"1.34"},{"last_update":"1519560241","involvement":"1.34"},{"last_update":"1519560301","involvement":"1.34"},{"last_update":"1519560362","involvement":"1.34"},{"last_update":"1519560421","involvement":"1.34"},{"last_update":"1519560481","involvement":"1.34"},{"last_update":"1519560541","involvement":"1.34"},{"last_update":"1519560602","involvement":"1.34"},{"last_update":"1519560662","involvement":"1.34"},{"last_update":"1519560721","involvement":"1.34"},{"last_update":"1519560781","involvement":"1.34"},{"last_update":"1519560841","involvement":"1.34"},{"last_update":"1519560902","involvement":"1.34"},{"last_update":"1519560911","involvement":"1.34"},{"last_update":"1519560961","involvement":"1.34"},{"last_update":"1519561021","involvement":"1.34"},{"last_update":"1519561081","involvement":"1.34"},{"last_update":"1519561141","involvement":"1.34"},{"last_update":"1519561202","involvement":"1.34"},{"last_update":"1519561262","involvement":"1.34"},{"last_update":"1519561322","involvement":"1.34"},{"last_update":"1519561381","involvement":"1.34"},{"last_update":"1519561444","involvement":"1.34"},{"last_update":"1519561501","involvement":"1.34"},{"last_update":"1519561561","involvement":"1.34"},{"last_update":"1519561621","involvement":"1.34"},{"last_update":"1519561681","involvement":"1.34"},{"last_update":"1519561741","involvement":"1.34"},{"last_update":"1519561802","involvement":"1.34"},{"last_update":"1519561861","involvement":"1.34"},{"last_update":"1519561921","involvement":"1.34"},{"last_update":"1519561981","involvement":"1.34"},{"last_update":"1519562041","involvement":"1.34"},{"last_update":"1519562102","involvement":"1.34"},{"last_update":"1519562161","involvement":"1.34"},{"last_update":"1519562221","involvement":"1.34"},{"last_update":"1519562282","involvement":"1.34"},{"last_update":"1519562342","involvement":"1.34"},{"last_update":"1519562401","involvement":"1.34"},{"last_update":"1519562462","involvement":"1.34"},{"last_update":"1519562522","involvement":"1.33"},{"last_update":"1519562581","involvement":"1.32"},{"last_update":"1519562641","involvement":"1.31"},{"last_update":"1519562702","involvement":"1.3"},{"last_update":"1519562761","involvement":"1.29"},{"last_update":"1519562821","involvement":"1.28"},{"last_update":"1519562881","involvement":"1.27"},{"last_update":"1519562941","involvement":"1.26"},{"last_update":"1519563002","involvement":"1.26"},{"last_update":"1519563061","involvement":"1.26"}];
for (var key in json) {

  console.log(key); // key1 and etc...
  console.log(json[key]); // val1 and etc...
}

There is such an array with data, how can you remove the names of the keys so that JSON takes the form:
[{1519563061,1.25},{1519563061,1.25}]and so on?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-02-25
@0example

In sense - to make objects arrays? For example:
json = json.map(Object.values)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question