@@ -259,14 +259,21 @@ module json_module
259259 !
260260 ! The types of JSON data.
261261 !
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
270277 ! *********************************************************
271278
272279 ! *********************************************************
@@ -916,8 +923,9 @@ end subroutine traverse_callback_func
916923 !
917924
918925 ! 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.
921929 character (kind= CK,len= :),allocatable :: err_message ! ! the error message
922930
923931 ! temp vars used when parsing lines in file [private variables]
@@ -1668,10 +1676,10 @@ subroutine json_initialize(verbose,compact_reals,print_signs,real_format)
16681676
16691677 implicit none
16701678
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
16751683
16761684 character (kind= CDK,len= 10 ) :: w,d,e
16771685 character (kind= CDK,len= 2 ) :: sgn, rl_edit_desc
@@ -3246,7 +3254,7 @@ pure function json_count(me) result(count)
32463254
32473255 count = me% n_children
32483256
3249- end function json_count
3257+ end function json_count
32503258! *****************************************************************************************
32513259
32523260! *****************************************************************************************
@@ -3754,6 +3762,9 @@ subroutine json_get_by_path(me, path, p, found)
37543762
37553763 character (kind= CK,len= 1 ),parameter :: start_array_alt = ' ('
37563764 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 = ' .'
37573768
37583769 integer (IK) :: i,length,child_i
37593770 character (kind= CK,len= 1 ) :: c
@@ -3778,21 +3789,21 @@ subroutine json_get_by_path(me, path, p, found)
37783789 c = path(i:i)
37793790
37803791 select case (c)
3781- case (CK_ ' $ ' )
3792+ case (root )
37823793
37833794 ! root
37843795 do while (associated (p% parent))
37853796 p = > p% parent
37863797 end do
37873798 child_i = i + 1
37883799
3789- case (CK_ ' @ ' )
3800+ case (this )
37903801
37913802 ! this
37923803 p = > me
37933804 child_i = i + 1
37943805
3795- case (CK_ ' . ' )
3806+ case (child )
37963807
37973808 ! get child member from p
37983809 if (child_i < i) then
0 commit comments