@@ -227,6 +227,7 @@ module json_value_module
227227 ! >
228228 ! Add objects to a linked list of [[json_value]]s.
229229 generic,public :: add = > json_value_add_member, &
230+ MAYBEWRAP(json_value_add_null), &
230231 MAYBEWRAP(json_value_add_integer), &
231232 MAYBEWRAP(json_value_add_integer_vec), &
232233 MAYBEWRAP(json_value_add_double), &
@@ -244,6 +245,7 @@ module json_value_module
244245
245246 procedure ,private :: json_value_add_member
246247 procedure ,private :: MAYBEWRAP(json_value_add_integer)
248+ procedure ,private :: MAYBEWRAP(json_value_add_null)
247249 procedure ,private :: MAYBEWRAP(json_value_add_integer_vec)
248250 procedure ,private :: MAYBEWRAP(json_value_add_double)
249251 procedure ,private :: MAYBEWRAP(json_value_add_double_vec)
@@ -1943,8 +1945,8 @@ subroutine json_value_validate(json,p,is_valid,error_msg)
19431945 class(json_core),intent (inout ) :: json
19441946 type (json_value),pointer ,intent (in ) :: p
19451947 logical (LK),intent (out ) :: is_valid ! ! True if the structure is valid.
1946- character (kind= CK,len= :),allocatable :: error_msg ! ! if not valid, this will contain
1947- ! ! a description of the problem
1948+ character (kind= CK,len= :),allocatable , intent ( out ) :: error_msg ! ! if not valid, this will contain
1949+ ! ! a description of the problem
19481950
19491951 if (associated (p)) then
19501952 is_valid = .true.
@@ -2581,6 +2583,49 @@ subroutine wrap_json_value_add_double_vec(json, p, name, val)
25812583 end subroutine wrap_json_value_add_double_vec
25822584! *****************************************************************************************
25832585
2586+ ! *****************************************************************************************
2587+ ! >
2588+ ! Add a NULL value child to the [[json_value]] variable
2589+ !
2590+ ! @note This routine is part of the public API that can be
2591+ ! used to build a JSON structure using [[json_value]] pointers.
2592+
2593+ subroutine json_value_add_null (json , p , name )
2594+
2595+ implicit none
2596+
2597+ class(json_core),intent (inout ) :: json
2598+ type (json_value),pointer :: p
2599+ character (kind= CK,len=* ),intent (in ) :: name
2600+
2601+ type (json_value),pointer :: var
2602+
2603+ ! create the variable:
2604+ call json% create_null(var,name)
2605+
2606+ ! add it:
2607+ call json% add(p, var)
2608+
2609+ end subroutine json_value_add_null
2610+ ! *****************************************************************************************
2611+
2612+ ! *****************************************************************************************
2613+ ! >
2614+ ! Alternate version of [[json_value_add_null]] where `name` is kind=CDK.
2615+
2616+ subroutine wrap_json_value_add_null (json , p , name )
2617+
2618+ implicit none
2619+
2620+ class(json_core),intent (inout ) :: json
2621+ type (json_value),pointer :: p
2622+ character (kind= CDK,len=* ),intent (in ) :: name ! ! name of the variable
2623+
2624+ call json% add(p, to_unicode(name))
2625+
2626+ end subroutine wrap_json_value_add_null
2627+ ! *****************************************************************************************
2628+
25842629! *****************************************************************************************
25852630! > author: Jacob Williams
25862631! date: 1/20/2014
0 commit comments