Skip to content

Commit b0dd61f

Browse files
Merge pull request #290 from jacobwilliams/duplicates
Check for duplicate keys.
2 parents d1db8ed + 15c1a31 commit b0dd61f

File tree

6 files changed

+542
-36
lines changed

6 files changed

+542
-36
lines changed

src/json_file_module.F90

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ subroutine initialize_json_core_in_file(me,verbose,compact_reals,&
338338
comment_char,&
339339
path_mode,&
340340
path_separator,&
341-
compress_vectors)
341+
compress_vectors,&
342+
allow_duplicate_keys)
342343

343344
implicit none
344345

@@ -355,7 +356,8 @@ subroutine initialize_json_core_in_file(me,verbose,compact_reals,&
355356
comment_char,&
356357
path_mode,&
357358
path_separator,&
358-
compress_vectors)
359+
compress_vectors,&
360+
allow_duplicate_keys)
359361

360362
end subroutine initialize_json_core_in_file
361363
!*****************************************************************************************
@@ -419,7 +421,8 @@ function initialize_json_file(p,verbose,compact_reals,&
419421
comment_char,&
420422
path_mode,&
421423
path_separator,&
422-
compress_vectors) result(file_object)
424+
compress_vectors,&
425+
allow_duplicate_keys) result(file_object)
423426

424427
implicit none
425428

@@ -438,7 +441,8 @@ function initialize_json_file(p,verbose,compact_reals,&
438441
comment_char,&
439442
path_mode,&
440443
path_separator,&
441-
compress_vectors)
444+
compress_vectors,&
445+
allow_duplicate_keys)
442446

443447
if (present(p)) file_object%p => p
444448

src/json_initialize_arguments.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@ logical(LK),intent(in),optional :: compress_vectors
5959
!! [Note: `no_whitespace` will
6060
!! override this option if necessary].
6161
!! (Default is False).
62+
logical(LK),intent(in),optional :: allow_duplicate_keys
63+
!! * If True [default] then no special checks
64+
!! are done to check for duplicate keys.
65+
!! * If False, then after parsing, if any duplicate
66+
!! keys are found, an error is thrown. A call to
67+
!! [[json_value_validate]] will also check for
68+
!! duplicates.

0 commit comments

Comments
 (0)