json_kinds Module

JSON-Fortran kind definitions.


  • JSON-Fortran is released under a BSD-style license. See the LICENSE file for details.


-DUSE_UCS4 is an optional preprocessor flag. When present, Unicode support is enabled. Note that this is currently only supported with the gfortran compiler. Example: gfortran -DUSE_UCS4 ... The documentation given here assumes USE_UCS4 is defined.


CK and CDK are the JSON-Fortran character kind and JSON-Fortran default character kind respectively. Client code MUST ensure characters of kind=CK are used for all character variables and strings passed to the JSON-Fortran library EXCEPT for file names which must be of 'DEFAULT' character kind, provided here as CDK. In particular, any variable that is a: json path, string value or object name passed to the JSON-Fortran library MUST be of type CK.


Most string literal constants of default kind are fine to pass as arguments to JSON-Fortran procedures since they have been overloaded to accept intent(in) character arguments of the default (CDK) kind. If you find a procedure which does not accept an intent(in) literal string argument of default kind, please file an issue on GitHub.


The default real kind (RK) and the default integer kind (IK) can be changed using optional preprocessor flags. This library was built with kinds: real(kind=real64) [8 bytes] and integer(kind=int32) [4 bytes] .


In addition to the real kind specified by RK, interfaces for the real kinds with less precision are also provided in the library, but all are converted to real(RK) variables internally.


  • module~~json_kinds~~UsesGraph module~json_kinds json_kinds iso_fortran_env iso_fortran_env module~json_kinds->iso_fortran_env

Used by

  • module~~json_kinds~~UsedByGraph module~json_kinds json_kinds module~json_file_module json_file_module module~json_file_module->module~json_kinds module~json_parameters json_parameters module~json_file_module->module~json_parameters module~json_string_utilities json_string_utilities module~json_file_module->module~json_string_utilities module~json_value_module json_value_module module~json_file_module->module~json_value_module module~json_module json_module module~json_module->module~json_kinds module~json_module->module~json_file_module module~json_module->module~json_parameters module~json_module->module~json_string_utilities module~json_module->module~json_value_module module~json_parameters->module~json_kinds module~json_string_utilities->module~json_kinds module~json_string_utilities->module~json_parameters module~json_value_module->module~json_kinds module~json_value_module->module~json_parameters module~json_value_module->module~json_string_utilities


Type Visibility Attributes Name Initial
integer, public, parameter :: CDK = selected_char_kind('DEFAULT')

Processor dependent ‘DEFAULT’ character kind. This is 1 byte for the Intel and Gfortran compilers.

integer, public, parameter :: CK = selected_char_kind(json_fortran_string_kind)

Default character kind used by JSON-Fortran. If ISO 10646 (UCS4) support is available, use that, otherwise, gracefully fall back on ‘DEFAULT’ characters. Currently only gfortran >= 4.9.2 will correctly support UCS4 which is stored in 4 bytes. (and perhaps others).

integer, public, parameter :: IK = int32

Default integer kind if not specified [4 bytes]

integer, public, parameter :: LK = logical_kinds(min(3, size(logical_kinds)))

Default logical kind. This is 4 bytes for the Intel and Gfortran compilers (and perhaps others). The declaration ensures a valid kind if the compiler doesn’t have a logical_kinds(3).

integer, public, parameter :: RK = real64

Default real kind if not specified [8 bytes]

character(kind=CDK, len=*), private, parameter :: json_fortran_string_kind = 'ISO_10646'

String kind preprocessor macro. gfortran compiler AND UCS4 support requested: