Update a nested object depth counter from one JSON line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
Current JSON line |
||
| integer, | intent(inout) | :: | object_depth |
Mutable object depth counter |
subroutine update_object_depth(line, object_depth) !! Update a nested object depth counter from one JSON line. implicit none ! Arguments character(*), intent(in) :: line !! Current JSON line integer, intent(inout) :: object_depth !! Mutable object depth counter ! Local variables integer :: i !! Character index while scanning braces do i = 1, len_trim(line) if(line(i:i) .eq. '{') object_depth = object_depth + 1 if(line(i:i) .eq. '}') object_depth = object_depth - 1 end do end subroutine update_object_depth