Correct JSON display of boolean values (was inverted)

Fixes #38
This commit is contained in:
Rob Giseburt
2020-01-10 19:25:10 -06:00
parent f8bdbb62eb
commit 64868f83ed
+5 -5
View File
@@ -141,7 +141,7 @@ static stat_t _json_parser_execute(nvObj_t *nv) {
}
// (*) Note: The JSON / token system is essentially flat, as it was derived from a command-line flat-ASCII approach
// If the JSON objects had proper recursive descent handlers that just passed the remaining string (at that level)
// If the JSON objects had proper recursive descent handlers that just passed the remaining string (at that level)
// off for further processing, we would not need to do this hack. A fix is in the works. For now, this is OK.
static stat_t _json_parser_kernal(nvObj_t *nv, char *str)
@@ -448,7 +448,7 @@ uint16_t json_serialize(nvObj_t *nv, char *out_buf, uint16_t size)
*str++ = '"';
break;
}
case (TYPE_BOOLEAN):{ if (nv->value_int) {
case (TYPE_BOOLEAN):{ if (!nv->value_int) {
strcpy(str, "false");
str += 5;
} else {
@@ -631,7 +631,7 @@ void json_print_response(uint8_t status, const bool only_to_muted /*= false*/)
* js_get_ej() - get JSON communications mode
* js_set_ej() - set JSON communications mode
*
* This one is a bit different:
* This one is a bit different:
* - cs.comm_mode is the setting for the *communications mode* (persistent)
* - js.json_mode is the actual current mode
*
@@ -657,7 +657,7 @@ stat_t js_set_ej(nvObj_t *nv)
stat_t js_get_jv(nvObj_t *nv) { return(get_integer(nv, js.json_verbosity)); }
stat_t js_set_jv(nvObj_t *nv)
{
ritorno (set_integer(nv, (uint8_t &)js.json_verbosity, JV_SILENT, JV_MAX_VALUE));
ritorno (set_integer(nv, (uint8_t &)js.json_verbosity, JV_SILENT, JV_MAX_VALUE));
js.echo_json_footer = false;
js.echo_json_messages = false;
@@ -693,7 +693,7 @@ stat_t json_set_ej(nvObj_t *nv)
nv->valuetype = TYPE_NULL;
return (STAT_INPUT_EXCEEDS_MAX_VALUE);
}
// set json_mode to 0 or 1, but don't change it if comm_mode == 2
if (commMode(nv->value) < AUTO_MODE) {
js.json_mode = commMode(nv->value);