@@ -169,6 +169,11 @@ module json_file_module
169169 json_file_update_string_val_ascii
170170#endif
171171
172+ ! >
173+ ! Remove a variable from a [[json_file(type)]]
174+ ! by specifying the path.
175+ generic,public :: remove = > MAYBEWRAP(json_file_remove)
176+
172177 ! traverse
173178 procedure ,public :: traverse = > json_file_traverse
174179
@@ -244,6 +249,9 @@ module json_file_module
244249 procedure :: json_file_update_string_val_ascii
245250#endif
246251
252+ ! remove:
253+ procedure :: MAYBEWRAP(json_file_remove)
254+
247255 ! print_file:
248256 procedure :: json_file_print_to_console
249257 procedure :: json_file_print_1
@@ -2192,6 +2200,42 @@ subroutine json_file_traverse(me,traverse_callback)
21922200 end subroutine json_file_traverse
21932201! *****************************************************************************************
21942202
2203+ ! *****************************************************************************************
2204+ ! > author: Jacob Williams
2205+ ! date: 7/7/2018
2206+ !
2207+ ! Remove a variable from a JSON file.
2208+ !
2209+ ! @note This is just a wrapper to [[remove_if_present]].
2210+
2211+ subroutine json_file_remove (me ,path )
2212+
2213+ implicit none
2214+
2215+ class(json_file),intent (inout ) :: me
2216+ character (kind= CK,len=* ),intent (in ) :: path ! ! the path to the variable
2217+
2218+ call me% core% remove_if_present(me% p,path)
2219+
2220+ end subroutine json_file_remove
2221+ ! *****************************************************************************************
2222+
2223+ ! *****************************************************************************************
2224+ ! >
2225+ ! Alternate version of [[json_file_remove]], where "path" is kind=CDK.
2226+
2227+ subroutine wrap_json_file_remove (me ,path )
2228+
2229+ implicit none
2230+
2231+ class(json_file),intent (inout ) :: me
2232+ character (kind= CDK,len=* ),intent (in ) :: path ! ! the path to the variable
2233+
2234+ call me% remove(to_unicode(path))
2235+
2236+ end subroutine wrap_json_file_remove
2237+ ! *****************************************************************************************
2238+
21952239! *****************************************************************************************
21962240 end module json_file_module
21972241! *****************************************************************************************
0 commit comments