19 type(json_file) :: data
93 call this%data%initialize(&
94 compact_reals=.true.,&
96 strict_type_checking=.true.,&
97 compress_vectors=.true.,&
98 stop_on_error=.false.,&
99 allow_duplicate_keys=.false.&
112 logical :: json_status
113 character(len=:),
allocatable :: error_msg
115 call this%data%check_for_errors(json_status, error_msg)
116 if (.not.json_status) error stop error_msg
128 call this%init_core()
140 character(len=*),
intent(in) :: str
142 call this%init_empty()
143 call this%data%deserialize(str)
144 call this%throw_error()
155 call this%data%destroy(.true.)
156 call this%throw_error()
179 call this%data%print()
180 call this%throw_error()
193 integer,
intent(in) :: iunit
195 call this%data%print(iunit)
196 call this%throw_error()
208 character(len=*),
intent(in) :: filename
210 call this%data%print(filename)
211 call this%throw_error()
223 character(len=*),
intent(in) :: filename
225 call this%data%load_file(filename, destroy_pointer=.true.)
226 call this%throw_error()
239 character(len=*),
intent(in) :: path
242 found = this%data%valid_path(path)
255 character(len=*),
intent(in) :: path
256 character(len=*),
intent(in) :: new_name
258 character(len=256) :: error_msg
260 call this%data%rename(path, new_name, found)
261 call this%throw_error()
263 write(error_msg,*)
"Key '", path,
"' not found!"
277 character(len=*),
intent(in) :: path
279 call this%data%remove(path)
280 call this%throw_error()
293 character(len=*),
intent(in) :: path
295 type(json_value),
pointer :: p, pclone
296 type(json_core) :: core
298 call this%data%get_core(core)
299 call value%data%get(p)
300 call core%clone(p,pclone)
301 call this%data%add(path, pclone)
302 call this%throw_error()
315 character(len=*),
intent(in) :: path
316 logical,
intent(in) :: value
318 call this%data%add(path,
value)
319 call this%throw_error()
332 character(len=*),
intent(in) :: path
333 integer,
intent(in) :: value
335 call this%data%add(path,
value)
336 call this%throw_error()
349 character(len=*),
intent(in) :: path
350 real(kind=double),
intent(in) ::
value
352 call this%data%add(path,
value)
353 call this%throw_error()
366 character(len=*),
intent(in) :: path
367 character(len=*),
intent(in) :: value
369 call this%data%add(path,
value, trim_str=.true., adjustl_str=.true.)
370 call this%throw_error()
383 character(len=*),
intent(in) :: path
384 logical,
dimension(:),
intent(in) :: value
386 call this%data%add(path,
value)
387 call this%throw_error()
400 character(len=*),
intent(in) :: path
401 integer,
dimension(:),
intent(in) :: value
403 call this%data%add(path,
value)
404 call this%throw_error()
417 character(len=*),
intent(in) :: path
418 real(kind=double),
dimension(:),
intent(in) ::
value
420 call this%data%add(path,
value)
421 call this%throw_error()
436 character(len=*),
intent(in) :: path
438 type(json_value),
pointer :: p, pclone
439 type(json_core) :: core
441 call this%data%get(path, p)
442 call this%data%get_core(core)
443 call core%clone(p, pclone)
444 call value%init_empty()
445 call value%data%add(pclone, destroy_original=.false.)
446 call this%throw_error()
461 character(len=*),
intent(in) :: path
462 integer,
intent(out) :: value
463 integer,
intent(in),
optional :: default
465 call this%data%get(path,
value, default=default)
466 call this%throw_error()
480 character(len=*),
intent(in) :: path
481 real(kind=double),
intent(out) ::
value
482 real(kind=double),
intent(in),
optional :: default
484 call this%data%get(path,
value, default=default)
485 call this%throw_error()
499 character(len=*),
intent(in) :: path
500 logical,
intent(out) :: value
501 logical,
intent(in),
optional :: default
503 call this%data%get(path,
value, default=default)
504 call this%throw_error()
521 character(len=*),
intent(in) :: path
522 character(len=:),
allocatable,
intent(out) :: value
523 character(len=*),
intent(in),
optional :: default
525 call this%data%get(path,
value, default=default)
526 call this%throw_error()
543 character(len=*),
intent(in) :: path
544 integer,
dimension(:),
allocatable,
intent(out) :: value
545 integer,
dimension(:),
intent(in),
optional :: default
547 call this%data%get(path,
value, default=default)
548 call this%throw_error()
565 character(len=*),
intent(in) :: path
566 real(kind=double),
dimension(:),
allocatable,
intent(out) ::
value
567 real(kind=double),
dimension(:),
intent(in),
optional :: default
569 call this%data%get(path,
value, default=default)
570 call this%throw_error()
587 character(len=*),
intent(in) :: path
588 logical,
dimension(:),
allocatable,
intent(out) :: value
589 logical,
dimension(:),
intent(in),
optional :: default
591 call this%data%get(path,
value, default=default)
592 call this%throw_error()
606 character(len=*),
intent(in) :: path
608 call this%data%add_null(path)
609 call this%throw_error()
625 character(len=*),
intent(in) :: path
626 integer,
intent(in) :: nvalues
628 call this%data%add_null(path, nvalues)
629 call this%throw_error()
645 this%data = other%data
subroutine get_integer(this, path, value, default)
Retrive integer primitive from loaded property tree.
subroutine set_logical(this, path, value)
Setup a logical boolean value inside the JSON tree.
subroutine get_vec_integer(this, path, value, default)
Parses target dynamically evaluated integer matrix structure hierarchy sequences.
subroutine finalize_json_type(this)
Finalization routine triggered implicitly when object goes out of scope or is destroyed.
subroutine get_vec_logical(this, path, value, default)
Returns memory structure block sequences representing dynamically stored logic array data.
subroutine get_logical(this, path, value, default)
Get a logical expression defined inside properties list mapping.
subroutine set_real(this, path, value)
Setup a float literal (double precision) value into JSON tree.
logical function check_path_is_valid(this, path)
Verify if a specific path exists within the JSON tree.
subroutine load_file_name(this, filename)
Construct a JSON structure from a JSON file path.
subroutine set_null_value(this, path)
Modifies payload hierarchy to explicitly associate a JSON null block.
subroutine throw_error(this)
Checks for parsing/runtime errors and raises Fortran exception.
subroutine remove_path(this, path)
Remove a node located at the specified path entirely.
subroutine rename_path(this, path, new_name)
Rename a node located at the specified path.
subroutine kill_json_type(this)
Destroys the JSON object and deallocates internal variables.
subroutine assign_json_type(this, other)
Prepares native assignments logic deeply copies mapping JSON representation states.
subroutine set_string(this, path, value)
Setup a JSON string scalar property.
subroutine write_to_console(this)
Print the JSON object representation to standard output.
subroutine init_string(this, str)
Initialize the object from a JSON string payload.
subroutine set_vec_logical(this, path, value)
Adds an array dimension of logic variables linearly.
subroutine get_string(this, path, value, default)
Retrieve string character definitions loaded dynamically via parsed map length format.
subroutine set_vec_real(this, path, value)
Adds an array literal values consisting of double precisions.
subroutine get_real(this, path, value, default)
Retrieve floating point double sequence type variable.
subroutine init_empty(this)
Initialize the object as an empty JSON file/database.
subroutine set_object(this, path, value)
Append a deeply copied instance of another JSON object at path.
subroutine init_core(this)
Static constructor for internal JSON core settings.
subroutine get_vec_real(this, path, value, default)
Retrives continuous unmapped values sequence containing decimal arrays.
subroutine set_integer(this, path, value)
Setup an integer value inside the JSON tree.
subroutine set_vec_null_value(this, path, nvalues)
Evaluates an explicitly formatted sized array mapped block of JSON null components.
subroutine write_to_file(this, filename)
Save the JSON object representation directly to a file.
subroutine set_vec_integer(this, path, value)
Adds an array block size containing integers to current root.
subroutine write_to_unit(this, iunit)
Print the JSON object representation to a specific formatted Fortran unit.
subroutine get_object(this, path, value)
Parses a subtree and clones its content into an alternative object variable.
Derived data type to handle JSON data.