File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,32 @@ for more examples.
92
92
end program example1
93
93
```
94
94
95
+ Modifying variables in a JSON file
96
+ ---------------
97
+
98
+ After reading a JSON file, if you want to change the values of some of the variables, you can use the ``` update ``` method. For the example above:
99
+
100
+ ``` fortran
101
+ ! [found can be used to check if the data was really there]
102
+ call json%update('version.major',9,found) !change major version to 9
103
+ call json%update('version.minor',0,found) !change minor version to 0
104
+ call json%update('version.patch',0,found) !change patch to 0
105
+ ```
106
+
95
107
Writing a JSON file
96
108
---------------
97
109
98
- Writing a json file is slightly more complicated and involves the use
110
+ To print the JSON file (either to a file or the console), the ``` print_file ``` method can be used. For the above example:
111
+
112
+ ``` fortran
113
+ call json%print_file() !prints to the console
114
+ call json%print_file(iunit) !prints to the file connnected to iunit
115
+ ```
116
+
117
+ Building a JSON file from scratch
118
+ ---------------
119
+
120
+ Constructing a JSON file element by element is slightly more complicated and involves the use
99
121
of pointers. See the json_example.f90 file for more examples.
100
122
101
123
``` fortran
You can’t perform that action at this time.
0 commit comments