@@ -76,18 +76,30 @@ module json_file_module
7676
7777 procedure ,public :: get_core = > get_json_core_in_file
7878
79+ ! >
80+ ! Load JSON from a file.
7981 procedure ,public :: load = > json_file_load
8082
8183 ! >
8284 ! The same as `load`, but only here for backward compatibility
8385 procedure ,public :: load_file = > json_file_load
8486
85- generic,public :: serialize = > MAYBEWRAP(json_file_load_from_string)
87+ ! >
88+ ! Load JSON from a string.
89+ generic,public :: deserialize = > MAYBEWRAP(json_file_load_from_string)
8690
8791 ! >
88- ! The same as `serialize `, but only here for backward compatibility
92+ ! The same as `deserialize `, but only here for backward compatibility
8993 generic,public :: load_from_string = > MAYBEWRAP(json_file_load_from_string)
9094
95+ ! >
96+ ! Print the [[json_value]] structure to an allocatable string
97+ procedure ,public :: serialize = > json_file_print_to_string
98+
99+ ! >
100+ ! The same as `serialize`, but only here for backward compatibility
101+ procedure ,public :: print_to_string = > json_file_print_to_string
102+
91103 procedure ,public :: destroy = > json_file_destroy
92104 procedure ,public :: nullify = > json_file_nullify
93105 procedure ,public :: move = > json_file_move_pointer
@@ -100,14 +112,6 @@ module json_file_module
100112 procedure ,public :: check_for_errors = > json_file_check_for_errors
101113 procedure ,public :: clear_exceptions = > json_file_clear_exceptions
102114
103- ! >
104- ! Print the [[json_value]] structure to an allocatable string
105- procedure ,public :: deserialize = > json_file_print_to_string
106-
107- ! >
108- ! The same as `deserialize`, but only here for backward compatibility
109- procedure ,public :: print_to_string = > json_file_print_to_string
110-
111115 generic,public :: print = > json_file_print_to_console, &
112116 json_file_print_to_unit, &
113117 json_file_print_to_filename
@@ -641,7 +645,7 @@ function initialize_json_file_from_string(str,&
641645 call file_object% initialize(&
642646#include " json_initialize_dummy_arguments.inc"
643647 )
644- call file_object% serialize (str)
648+ call file_object% deserialize (str)
645649
646650 end function initialize_json_file_from_string
647651! *****************************************************************************************
@@ -685,7 +689,7 @@ function initialize_json_file_from_string_v2(str, json_core_object) &
685689 type (json_core),intent (in ) :: json_core_object
686690
687691 file_object% core = json_core_object
688- call file_object% serialize (str)
692+ call file_object% deserialize (str)
689693
690694 end function initialize_json_file_from_string_v2
691695! *****************************************************************************************
@@ -857,7 +861,7 @@ end subroutine json_file_load
857861! Load JSON from a string:
858862! ```fortran
859863! type(json_file) :: f
860- ! call f%serialize ('{ "name": "Leonidas" }')
864+ ! call f%deserialize ('{ "name": "Leonidas" }')
861865! ```
862866
863867 subroutine json_file_load_from_string (me , str )
@@ -867,7 +871,7 @@ subroutine json_file_load_from_string(me, str)
867871 class(json_file),intent (inout ) :: me
868872 character (kind= CK,len=* ),intent (in ) :: str ! ! string to load JSON data from
869873
870- call me% core% serialize (me% p, str)
874+ call me% core% deserialize (me% p, str)
871875
872876 end subroutine json_file_load_from_string
873877! *****************************************************************************************
@@ -883,7 +887,7 @@ subroutine wrap_json_file_load_from_string(me, str)
883887 class(json_file),intent (inout ) :: me
884888 character (kind= CDK,len=* ),intent (in ) :: str
885889
886- call me% serialize (to_unicode(str))
890+ call me% deserialize (to_unicode(str))
887891
888892 end subroutine wrap_json_file_load_from_string
889893! *****************************************************************************************
@@ -970,7 +974,7 @@ end subroutine json_file_print_to_filename
970974! type(json_file) :: f
971975! character(kind=CK,len=:),allocatable :: str
972976! call f%load('my_file.json')
973- ! call f%deserialize (str)
977+ ! call f%serialize (str)
974978! ```
975979
976980 subroutine json_file_print_to_string (me ,str )
@@ -980,7 +984,7 @@ subroutine json_file_print_to_string(me,str)
980984 class(json_file),intent (inout ) :: me
981985 character (kind= CK,len= :),allocatable ,intent (out ) :: str ! ! string to print JSON data to
982986
983- call me% core% deserialize (me% p,str)
987+ call me% core% serialize (me% p,str)
984988
985989 end subroutine json_file_print_to_string
986990! *****************************************************************************************
0 commit comments