I'm trying to filter the json file so that it only contains certain key-value pairs. I have been looking around stack overflow but none of the solutions meet my needs.
I made the json file into a var and tried using this piece of code but it fails for some reason, saying that [object array] is not a function.
var newArr = data.map(data, function(object) {
return data.pick(object, ['time', 'practical_salinity']);});
[
{
"practical_salinity": 33.435064643342436,
"seawater_pressure": 101.78123944323164,
"corrected_dissolved_oxygen": 164.09190464800648,
"density_qc_executed": 29,
"driver_timestamp": 3765193211.34625,
"conductivity": 1493552,
"seawater_pressure_qc_results": 29,
"practical_salinity_qc_results": 29,
"temperature": 411414,
"density": 1026.3321779687496,
"corrected_dissolved_oxygen_qc_executed": 29,
"corrected_dissolved_oxygen_qc_results": 29,
"seawater_temperature_qc_results": 29,
"pressure_temp": 14964,
"internal_timestamp": 0.0,
"seawater_conductivity_qc_results": 13,
"pk": {
"node": "SF01A",
"stream": "ctdpf_sbe43_sample",
"subsite": "RS01SBPS",
"deployment": 6,
"time": 3765193211.283541,
"sensor": "2A-CTDPFA102",
"method": "streamed"
},
"ext_volt0": 22775,
"seawater_temperature": 9.178755142917169,
"ingestion_timestamp": 3765193215.771,
"port_timestamp": 3765193211.283541,
"seawater_pressure_qc_executed": 29,
"pressure": 629441,
"preferred_timestamp": "port_timestamp",
"seawater_conductivity": 3.5856973775744,
"practical_salinity_qc_executed": 29,
"seawater_temperature_qc_executed": 29,
"density_qc_results": 29,
"time": 3765193211.283541,
"seawater_conductivity_qc_executed": 29
}]
From this json file, I would like the output to be,
[{"practical_salinity": 33.435064643342436,
"pressure": 629441}]