These are the specific objects I am working with:
{"event":"auth success"}
{"event":"status","args":["running"]}
{"event":"console output","args":["openjdk version \"11.0.10\" 2021-01-19"]}
{"event":"console output","args":["OpenJDK Runtime Environment 18.9 (build 11.0.10+9)"]}
{"event":"console output","args":["OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode, sharing)"]}
I am incorporating this in my JavaScript code:
var JSONObject = JSON.parse(event.data);
var theDiv = document.getElementById("cli");
theDiv.innerHTML += "<div>"+JSONObject["args"]+"</div>";
The result displayed is as follows:
undefined
running
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment 18.9 (build 11.0.10+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode, sharing)
Is there a way to extract only the value of args when event is equal to "console output"?