let´s assume i have a json message:
json_msg =
[{ LOG: 'TPT',
TYPE: 'UPDATE',
UIN: 'VEHICLE',
SEQ_NO: 20129,
VALUE: 1,
TIMESTAMP: 518342.438263017,
EXPERIMENT: 0,
IDENT: '.Model.Index_obj.MuLifeCycle_obj.Mu.vh_Transporter:2',
STAGE: 'START',
MODE: '' },
{ LOG: 'TPT',
TYPE: 'UPDATE',
UIN: 'VEHICLE',
SEQ_NO: 20129,
VALUE: 1,
TIMESTAMP: 518342.438263017,
EXPERIMENT: 0,
IDENT: '.Model.Index_obj.MuLifeCycle_obj.Mu.vh_Transporter:2',
STAGE: 'START',
MODE: '' }.
{ LOG: 'TPT',
TYPE: 'UPDATE',
UIN: 'VEHICLE',
SEQ_NO: 20129,
VALUE: 1,
TIMESTAMP: 518342.438263017,
EXPERIMENT: 0,
IDENT: '.Model.Index_obj.MuLifeCycle_obj.Mu.vh_Transporter:2',
STAGE: 'START',
MODE: '' }]
and i want to append it to an empty json object
var testObject = {}
and now i want to use a loop in order to append these json-messages in testObject
for (let i =0; i< json_msg.length; i++) {
// TODO
testObject.push(json_msg[i])} // does not work
Somebody has an idea?
Note that this is a test-case. My real-life example filters incoming json messages and i want a class method that appends these filtered messages into a new JSON Object message (same like '.push' for arrays).