Return units within the JSON response
See original GitHub issueHello, is there a way to add a new output perhaps that returns the unit with the value in json format?
Specifically, I would like data[key][1] to be returned within the JSON.
Here’s the snipped I’m talking about but I’m not sure what would be the best solution regarding specifying a certain flag or a new output type in order to not cause any regressions.
In other words, I’m looking for an output similar to this:
{ "ac_output_voltage": { "value": 220, "unit": "V" }, ... }
Instead of this:
{ "ac_output_voltage": 220, ... }
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to unit test an Action method which returns JsonResult?
JsonResult returns an anonymous object and these are, by default, internal , so they need to be made visible to the tests project....
Read more >Spring Web MVC – Return JSON in Response Body
In this tutorial, you will learn how to use the @ResponseBody annotation to return JSON in the HTTP response body.
Read more >Unit Testing — Parsing a JSON response - Medium
Remind that the server can return different responses e.g. a 404 status. We need to parse our JSON, that means to grab the...
Read more >Response.json() - Web APIs - MDN Web Docs
The json() method of the Response interface takes a Response stream and reads it to completion. It returns a promise which resolves with...
Read more >Spring Web MVC | 12 | Return JSON in Response Body
In this video lesson, you will learn how to return JSON in HTTP Response Body of your Spring MVC Web application.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

this one is a bit harder as i need to refactor to core code and expand the command definitions - working on it though
Thanks for that! I guess an output called
json_mqtt_unitsor something similar should be added as well. Same goes for UDP (for completeness).