@@ -227,6 +227,7 @@ module json_value_module
227
227
! >
228
228
! Add objects to a linked list of [[json_value]]s.
229
229
generic,public :: add = > json_value_add_member, &
230
+ MAYBEWRAP(json_value_add_null), &
230
231
MAYBEWRAP(json_value_add_integer), &
231
232
MAYBEWRAP(json_value_add_integer_vec), &
232
233
MAYBEWRAP(json_value_add_double), &
@@ -244,6 +245,7 @@ module json_value_module
244
245
245
246
procedure ,private :: json_value_add_member
246
247
procedure ,private :: MAYBEWRAP(json_value_add_integer)
248
+ procedure ,private :: MAYBEWRAP(json_value_add_null)
247
249
procedure ,private :: MAYBEWRAP(json_value_add_integer_vec)
248
250
procedure ,private :: MAYBEWRAP(json_value_add_double)
249
251
procedure ,private :: MAYBEWRAP(json_value_add_double_vec)
@@ -1943,8 +1945,8 @@ subroutine json_value_validate(json,p,is_valid,error_msg)
1943
1945
class(json_core),intent (inout ) :: json
1944
1946
type (json_value),pointer ,intent (in ) :: p
1945
1947
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
1948
1950
1949
1951
if (associated (p)) then
1950
1952
is_valid = .true.
@@ -2581,6 +2583,49 @@ subroutine wrap_json_value_add_double_vec(json, p, name, val)
2581
2583
end subroutine wrap_json_value_add_double_vec
2582
2584
! *****************************************************************************************
2583
2585
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
+
2584
2629
! *****************************************************************************************
2585
2630
! > author: Jacob Williams
2586
2631
! date: 1/20/2014
0 commit comments