Closed sheldonmaschmeyer closed 1 year ago
The jetson.stats is almost a valid JSON string but I need to make tweaks to the string for it to pass validation.
jetson.stats
The following is done in JavaScript.
jetsonStats = jetsonStats.replace(/'/g, '"'); jetsonStats = jetsonStats.replace(/: datetime/g, ': "datetime'); jetsonStats = jetsonStats.replace(/\),/g, ')",'); JSON.parse(jetsonStats) // Success
Steps to reproduce the behavior:
jetson = jtop() jetson.start() print(jetson.stats) jetson.close()
Copy string to an online validator such as https://jsonlint.com/ Notice it does not pass.
Pass string to Node.JS
jetsonStats = jetsonStats.replace(/'/g, '"'); jetsonStats = jetsonStats.replace(/: datetime/g, ': "datetime'); jetsonStats = jetsonStats.replace(/\),/g, ')",'); console.debug(jetsonStats) JSON.parse(jetsonStats)
Notice it now passes the online validator https://jsonlint.com/
Ubuntu 18.04 jetson-stats==4.1.5
Found article https://www.influxdata.com/blog/nvidia-jetson-series-part-1-jetson-stats/
There is now a new function
jetson.json()
https://rnext.it/jetson_stats/reference/jtop.html#jtop.jtop.json
Thanks :+1:
Describe the bug
The
jetson.stats
is almost a valid JSON string but I need to make tweaks to the string for it to pass validation.The following is done in JavaScript.
To Reproduce
Steps to reproduce the behavior:
Copy string to an online validator such as https://jsonlint.com/ Notice it does not pass.
Pass string to Node.JS
Notice it now passes the online validator https://jsonlint.com/
Board
Ubuntu 18.04 jetson-stats==4.1.5