@@ -113,6 +113,10 @@ module json_module
113
113
114
114
character (len=* ),parameter :: real_fmt = ' (E30.16E3)' ! format for real numbers
115
115
character (len=* ),parameter :: int_fmt = ' (I10)' ! format for integers
116
+ character (len=* ),parameter :: null_str = ' null'
117
+ character (len=* ),parameter :: true_str = ' true'
118
+ character (len=* ),parameter :: false_str = ' false'
119
+
116
120
117
121
! The types of data:
118
122
integer ,parameter ,public :: json_unknown = 0
@@ -2399,7 +2403,7 @@ recursive subroutine json_value_print(this,iunit,indent,need_comma,colon,str)
2399
2403
2400
2404
case (json_null)
2401
2405
2402
- call write_it( repeat (space, spaces)// ' null ' , comma= print_comma )
2406
+ call write_it( repeat (space, spaces)// null_str , comma= print_comma )
2403
2407
2404
2408
case (json_string)
2405
2409
@@ -2416,9 +2420,9 @@ recursive subroutine json_value_print(this,iunit,indent,need_comma,colon,str)
2416
2420
case (json_logical)
2417
2421
2418
2422
if (this% data % log_value) then
2419
- call write_it( repeat (space, spaces)// ' true ' , comma= print_comma )
2423
+ call write_it( repeat (space, spaces)// true_str , comma= print_comma )
2420
2424
else
2421
- call write_it( repeat (space, spaces)// ' false ' , comma= print_comma )
2425
+ call write_it( repeat (space, spaces)// false_str , comma= print_comma )
2422
2426
end if
2423
2427
2424
2428
case (json_integer)
@@ -3747,23 +3751,24 @@ recursive subroutine parse_value(unit, value)
3747
3751
end select
3748
3752
! end associate
3749
3753
3750
- case (' t ' )
3754
+ case (true_str( 1 : 1 ) )
3751
3755
3752
3756
! true
3753
- call parse_for_chars(unit, ' rue ' )
3757
+ call parse_for_chars(unit, true_str( 2 :) )
3754
3758
! allocate class and set value:
3755
3759
if (.not. exception_thrown) call to_logical(value,.true. )
3756
3760
3757
- case (' f ' )
3761
+ case (false_str( 1 : 1 ) )
3758
3762
3759
3763
! false
3760
- call parse_for_chars(unit, ' alse ' )
3764
+ call parse_for_chars(unit, false_str( 2 :) )
3761
3765
! allocate class and set value:
3762
3766
if (.not. exception_thrown) call to_logical(value,.false. )
3763
3767
3764
- case (' n ' )
3768
+ case (null_str( 1 : 1 ) )
3765
3769
3766
- call parse_for_chars(unit, ' ull' )
3770
+ ! null
3771
+ call parse_for_chars(unit, null_str(2 :))
3767
3772
if (.not. exception_thrown) call to_null(value) ! allocate class
3768
3773
3769
3774
case (' -' , ' 0' : ' 9' )
0 commit comments