The following commit has been merged in the master branch: commit 81bc72889b76209550b8e88a556ae48dc3b868d3 Author: Sven Eckelmann sven@narfation.org Date: Sat Apr 23 16:34:00 2011 +0200
batctl: Fix JSON object output
Each line is a single JSON object and has to start with '{' and no spaces are allowed before it. Each pair has to be identified with a string in double quotes.
Signed-off-by: Sven Eckelmann sven@narfation.org
diff --git a/vis.c b/vis.c index eb77872..adb12d0 100644 --- a/vis.c +++ b/vis.c @@ -126,33 +126,33 @@ static void json_print_tq(char *orig, char *from, const long tq) int int_part = TQ_MAX_VALUE / tq; int frac_part = (1000 * TQ_MAX_VALUE / tq) - (int_part * 1000);
- printf("\t{ router : "%s", ", + printf("{ "router" : "%s", ", get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0))); - printf("neighbor : "%s", label : "%d.%03d" }\n", + printf(""neighbor" : "%s", "label" : "%d.%03d" }\n", get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0)), int_part, frac_part); }
static void json_print_HNA(char *orig, char *from) { - printf("\t{ router : "%s", ", + printf("{ "router" : "%s", ", get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0))); - printf("gateway : "%s", label : "HNA" }\n", + printf(""gateway" : "%s", "label" : "HNA" }\n", get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0))); }
static void json_print_1st(char *orig) { - printf("\t{ primary : "%s" }\n", + printf("{ "primary" : "%s" }\n", get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0))); }
static void json_print_2nd(char *orig, char *from) { - printf("\t{ secondary : "%s", ", + printf("{ "secondary" : "%s", ", get_name_by_macstr(from, (with_names ? USE_BAT_HOSTS : 0)));
- printf("of : "%s" }\n", + printf(""of" : "%s" }\n", get_name_by_macstr(orig, (with_names ? USE_BAT_HOSTS : 0))); }