From 821488d39ec863a3b6c57df4f8867706ec0ab685 Mon Sep 17 00:00:00 2001 From: Nishant Bansal Date: Mon, 28 Oct 2024 21:23:30 +0530 Subject: [PATCH] additional changes based on review Signed-off-by: Nishant Bansal --- vector/v.info/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vector/v.info/main.c b/vector/v.info/main.c index b197cb176e8..ef1f5c44d06 100644 --- a/vector/v.info/main.c +++ b/vector/v.info/main.c @@ -54,11 +54,6 @@ int main(int argc, char *argv[]) parse_args(argc, argv, &input_opt, &field_opt, &hist_flag, &col_flag, &shell_flag, &format); - if (format == JSON) { - root_value = json_value_init_object(); - root_object = json_value_get_object(root_value); - } - /* try to open head-only on level 2 */ if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2) { /* force level 1, open fully @@ -92,6 +87,11 @@ int main(int argc, char *argv[]) return (EXIT_SUCCESS); } + if (format == JSON) { + root_value = json_value_init_object(); + root_object = json_value_get_object(root_value); + } + if ((shell_flag & SHELL_BASIC) || format == JSON) { print_shell(&Map, field_opt, format, root_object); }