0
I’m having a hard time converting string {data}
in Json
, I get her separated by comma several times, I’d like to turn her into Json
to collect the first key
var data = [ "$SP", "92", "00:01:36.340", "00:05:48.929\n" ];
var data = [ "$MT", "91", "00:00:34.187", "00:18:44.001\n" ];
the desired would be:
{
"$SP":{
"0":92,
"1":"00:01:36.340",
"2":"00:05:48.929",
}
},
{
"$MT":{
"0":91,
"1":"00:00:34.187",
"2":00:18:44.001,
}
}
Your variable
data
in question is an array or a string?– sant0will
is a string, I can create an array from it with split
– Monogarm
If you can edit the question stating the return of this string
data
.– sant0will
I didn’t understand the pq of having two variables with the same name!
– LeAndrade
I receive this string several times, that is, every second I have an update of it, so the example
– Monogarm