66#include <grass/gjson.h>
77
88// Function to initialize a JSON object with a mapsets array
9- static JSON_Object * initialize_json_object (void )
9+ static G_JSON_Object * initialize_json_object (void )
1010{
11- JSON_Value * root_value = G_json_value_init_object ();
11+ G_JSON_Value * root_value = G_json_value_init_object ();
1212 if (!root_value ) {
1313 G_fatal_error (_ ("Failed to initialize JSON object. Out of memory?" ));
1414 }
1515
16- JSON_Object * root_object = G_json_value_get_object (root_value );
16+ G_JSON_Object * root_object = G_json_value_get_object (root_value );
1717 G_json_object_set_value (root_object , "mapsets" , G_json_value_init_array ());
1818
19- JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
19+ G_JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
2020 if (!mapsets ) {
2121 G_json_value_free (root_value );
2222 G_fatal_error (_ ("Failed to initialize mapsets array. Out of memory?" ));
@@ -26,7 +26,7 @@ static JSON_Object *initialize_json_object(void)
2626}
2727
2828// Function to serialize and print JSON object
29- static void serialize_and_print_json_object (JSON_Value * root_value )
29+ static void serialize_and_print_json_object (G_JSON_Value * root_value )
3030{
3131 char * serialized_string = G_json_serialize_to_string_pretty (root_value );
3232 if (!serialized_string ) {
@@ -73,8 +73,8 @@ void list_accessible_mapsets(const char *fs)
7373void list_accessible_mapsets_json (void )
7474{
7575 const char * name ;
76- JSON_Object * root_object = initialize_json_object ();
77- JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
76+ G_JSON_Object * root_object = initialize_json_object ();
77+ G_JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
7878
7979 for (int n = 0 ; (name = G_get_mapset_name (n )); n ++ ) {
8080 G_json_array_append_string (mapsets , name );
@@ -87,8 +87,8 @@ void list_accessible_mapsets_json(void)
8787// Lists available mapsets from a provided array in JSON format
8888void list_avaliable_mapsets_json (const char * * mapset_names , int nmapsets )
8989{
90- JSON_Object * root_object = initialize_json_object ();
91- JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
90+ G_JSON_Object * root_object = initialize_json_object ();
91+ G_JSON_Array * mapsets = G_json_object_get_array (root_object , "mapsets" );
9292
9393 for (int n = 0 ; n < nmapsets ; n ++ ) {
9494 G_json_array_append_string (mapsets , mapset_names [n ]);
0 commit comments