I am working with an API that retrieves data in the following format:
{"t":"point","id":817315,"tableid":141,"classid":142,"state":0,"loc":[6850735.34375,24501674.0039063]}
{"t":"line","id":817314,"tableid":204,"classid":2102,"loc":[[6850335.8828125,24501476.50390625],[6850341.48828125,24501476.8828125],[6850362.171875,24501492.21484375],[6850387.4140625,24501508.86328125],[6850442.66796875,24501545.69921875],[6850502.34375,24501584.0078125],[6850558.3359375,24501619.37109375],[6850611.375,24501654.73046875],[6850671.05078125,24501693.04296875],[6850708.62109375,24501687.1484375],[6850735.34375,24501674.00390625]]}
The code snippet below is used to fetch this data:
oboe('http://localhost:19100/pn/api/v1/fetch?cgid=22&north=6853000.0&east=24505000&south=6850000.0&west=24500000.0')
.node('*', (row) => {
console.log(row);
return oboe.drop;
})
.done(() => {
return oboe.drop;
})
.fail((err) => {
// error
console.log('oboe fail ', err);
return oboe.drop;
});
Instead of receiving each value(row) separately, I want the entire JSON object on each line to be processed into an object.
I posted a similar question on Stack Overflow, but it got mistaken for a CORS issue related to the API service.