@@ -259,14 +259,21 @@ module json_module
259
259
!
260
260
! The types of JSON data.
261
261
!
262
- integer (IK),parameter ,public :: json_unknown = 0 ! ! Unknown JSON data type (see [[json_file_variable_info]] and [[json_info]])
263
- integer (IK),parameter ,public :: json_null = 1 ! ! Null JSON data type (see [[json_file_variable_info]] and [[json_info]])
264
- integer (IK),parameter ,public :: json_object = 2 ! ! Object JSON data type (see [[json_file_variable_info]] and [[json_info]])
265
- integer (IK),parameter ,public :: json_array = 3 ! ! Array JSON data type (see [[json_file_variable_info]] and [[json_info]])
266
- integer (IK),parameter ,public :: json_logical = 4 ! ! Logical JSON data type (see [[json_file_variable_info]] and [[json_info]])
267
- integer (IK),parameter ,public :: json_integer = 5 ! ! Integer JSON data type (see [[json_file_variable_info]] and [[json_info]])
268
- integer (IK),parameter ,public :: json_double = 6 ! ! Double JSON data type (see [[json_file_variable_info]] and [[json_info]])
269
- integer (IK),parameter ,public :: json_string = 7 ! ! String JSON data type (see [[json_file_variable_info]] and [[json_info]])
262
+ integer (IK),parameter ,public :: json_unknown = 0 ! ! Unknown JSON data type
263
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
264
+ integer (IK),parameter ,public :: json_null = 1 ! ! Null JSON data type
265
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
266
+ integer (IK),parameter ,public :: json_object = 2 ! ! Object JSON data type
267
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
268
+ integer (IK),parameter ,public :: json_array = 3 ! ! Array JSON data type
269
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
270
+ integer (IK),parameter ,public :: json_logical = 4 ! ! Logical JSON data type
271
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
272
+ integer (IK),parameter ,public :: json_integer = 5 ! ! Integer JSON data type
273
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
274
+ integer (IK),parameter ,public :: json_double = 6 ! ! Double JSON data type
275
+ ! ! (see [[json_file_variable_info]] and [[json_info]])
276
+ integer (IK),parameter ,public :: json_string = 7 ! ! String JSON data type
270
277
! *********************************************************
271
278
272
279
! *********************************************************
@@ -916,8 +923,9 @@ end subroutine traverse_callback_func
916
923
!
917
924
918
925
! exception handling [private variables]
919
- logical (LK) :: is_verbose = .false. ! ! if true, all exceptions are immediately printed to console
920
- logical (LK) :: exception_thrown = .true. ! ! the error flag (by default, this is true to make sure that [[json_initialize]] is called.
926
+ logical (LK) :: is_verbose = .false. ! ! if true, all exceptions are immediately printed to console
927
+ logical (LK) :: exception_thrown = .true. ! ! the error flag (by default, this is true to
928
+ ! ! make sure that [[json_initialize]] is called.
921
929
character (kind= CK,len= :),allocatable :: err_message ! ! the error message
922
930
923
931
! temp vars used when parsing lines in file [private variables]
@@ -1668,10 +1676,10 @@ subroutine json_initialize(verbose,compact_reals,print_signs,real_format)
1668
1676
1669
1677
implicit none
1670
1678
1671
- logical (LK),intent (in ),optional :: verbose ! ! mainly useful for debugging (default is false)
1672
- logical (LK),intent (in ),optional :: compact_reals ! ! to compact the real number strings for output (default is true)
1673
- logical (LK),intent (in ),optional :: print_signs ! ! always print numeric sign (default is false)
1674
- character (len=* ,kind= CDK),intent (in ),optional :: real_format ! ! exponential (default), scientific, engineering or general
1679
+ logical (LK),intent (in ),optional :: verbose ! ! mainly useful for debugging (default is false)
1680
+ logical (LK),intent (in ),optional :: compact_reals ! ! to compact the real number strings for output (default is true)
1681
+ logical (LK),intent (in ),optional :: print_signs ! ! always print numeric sign (default is false)
1682
+ character (len=* ,kind= CDK),intent (in ),optional :: real_format ! ! exponential (default), scientific, engineering or general
1675
1683
1676
1684
character (kind= CDK,len= 10 ) :: w,d,e
1677
1685
character (kind= CDK,len= 2 ) :: sgn, rl_edit_desc
@@ -3246,7 +3254,7 @@ pure function json_count(me) result(count)
3246
3254
3247
3255
count = me% n_children
3248
3256
3249
- end function json_count
3257
+ end function json_count
3250
3258
! *****************************************************************************************
3251
3259
3252
3260
! *****************************************************************************************
@@ -3754,6 +3762,9 @@ subroutine json_get_by_path(me, path, p, found)
3754
3762
3755
3763
character (kind= CK,len= 1 ),parameter :: start_array_alt = ' ('
3756
3764
character (kind= CK,len= 1 ),parameter :: end_array_alt = ' )'
3765
+ character (kind= CK,len= 1 ),parameter :: root = ' $'
3766
+ character (kind= CK,len= 1 ),parameter :: this = ' @'
3767
+ character (kind= CK,len= 1 ),parameter :: child = ' .'
3757
3768
3758
3769
integer (IK) :: i,length,child_i
3759
3770
character (kind= CK,len= 1 ) :: c
@@ -3778,21 +3789,21 @@ subroutine json_get_by_path(me, path, p, found)
3778
3789
c = path(i:i)
3779
3790
3780
3791
select case (c)
3781
- case (CK_ ' $ ' )
3792
+ case (root )
3782
3793
3783
3794
! root
3784
3795
do while (associated (p% parent))
3785
3796
p = > p% parent
3786
3797
end do
3787
3798
child_i = i + 1
3788
3799
3789
- case (CK_ ' @ ' )
3800
+ case (this )
3790
3801
3791
3802
! this
3792
3803
p = > me
3793
3804
child_i = i + 1
3794
3805
3795
- case (CK_ ' . ' )
3806
+ case (child )
3796
3807
3797
3808
! get child member from p
3798
3809
if (child_i < i) then
0 commit comments