jacobwilliams / json-fortran

A Modern Fortran JSON API
https://jacobwilliams.github.io/json-fortran/
Other
333 stars 82 forks source link

Can not find some variables in json file #541

Closed mahmood19227 closed 3 months ago

mahmood19227 commented 11 months ago

In a loop I everytime read a jsonfile, and extract some numbers from that. with codes like this:

 call jsonfile%get('Equipments.Drilling.MP1Throttle',Equipments%DrillingConsole%MP1Throttle,found)

 if ( .not. found ) then
    call logg(4,"Not found: MP1Throttle")
 endif

Each iteration is happened in a subroutine with local variables. So every things are redefined and reinitialized, including jsonfile and json core. So it is not possible to remain some pointer or variable from past iteration. In the beginning every thing is OK. But if in the middle of execution, number of digits of a number in the json files are changed (for example MP1Throttle goes from 9 to 10), jsonfile cannot find this value! Why this situation is happened?

jacobwilliams commented 10 months ago

It's hard to say without a full example that I can compile and reproduce the issue.