-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"traverse" json_file #204
Comments
Yes, I can certainly add this (there are various routines that are not included in |
(To give some more context: the main motivation is being able to pass optional arguments to subroutines in a way similar to python **kwargs. For now I'm using the FPL "dictionary", but using json instead has a number of advantages...) |
I was thinking, in order for this to work, I'd need to give access to the So, if I just made it public, then I think you could do what you wanted like this: type(json_file) :: json
call json%load_from_string('{"option1" : real, '//&
'"option2" : bool', //&
'"option3" : string')
call json%json%traverse(check_options) (Maybe I would rename it from Need to think about this some more... are there any adverse consequences to making this public? It might be OK. |
So the The alternative is just a thin traverse wrapper that calls (I am not current on all your latest changes, so I could be wrong here...) |
Yes, that is correct. The problem with the thin wrapper function is that you can't really do anything with An alternate would be to have another method that returns the So, I think making |
Actually, turns out it's not necessary to make |
Brilliant! :) |
First thing, fantastic library, thanks for releasing it !!
I'm in a situation where I need to "traverse" the node in a json structure. Following the example in jf_test_14.f90, I can do it by using the following syntax
Where
check_options
is a custom routine. It would be useful being able to traverse the structure from the higher leveljson_file
class, since this would save me the need of passing around bothjson_core
andjson_value
, or to call each time thejson_core
methods explicitly.In other words: is there a way to use
?
The text was updated successfully, but these errors were encountered: