@@ -193,7 +193,11 @@ module json_module
193
193
!
194
194
! EXAMPLE
195
195
! type(json_file) :: json
196
- ! call json%load_file(filename)
196
+ ! integer :: ival
197
+ ! real(wp) :: rval
198
+ ! character(len=:),allocatable :: cval
199
+ ! logical :: found
200
+ ! call json%load_file(filename='myfile.json')
197
201
! call json%print_file()
198
202
! call json%get('var.i',ival,found)
199
203
! call json%get('var.d',rval,found)
@@ -254,20 +258,52 @@ subroutine array_callback_func(element, i, count)
254
258
integer ,intent (in ) :: count ! size of array
255
259
end subroutine array_callback_func
256
260
end interface
257
-
261
+
262
+ ! *************************************************************************************
263
+ ! ****f* json_module/json_value_get
264
+ !
265
+ ! NAME
266
+ ! json_value_get
267
+ !
268
+ ! DESCRIPTION
269
+ ! Get a child, either by index or name string.
270
+ !
271
+ ! SOURCE
258
272
interface json_value_get ! consider renaming this json_value_get_child
259
273
module procedure get_by_index
260
274
module procedure get_by_name_chars
261
275
end interface json_value_get
262
-
276
+ ! *************************************************************************************
277
+
278
+ ! *************************************************************************************
279
+ ! ****f* json_module/json_value_add
280
+ !
281
+ ! NAME
282
+ ! json_value_add
283
+ !
284
+ ! DESCRIPTION
285
+ ! Add objects to a linked list of json_values.
286
+ !
287
+ ! SOURCE
263
288
interface json_value_add
264
289
module procedure :: json_value_add_member
265
290
module procedure :: json_value_add_integer, json_value_add_integer_vec
266
291
module procedure :: json_value_add_real, json_value_add_real_vec
267
292
module procedure :: json_value_add_logical, json_value_add_logical_vec
268
293
module procedure :: json_value_add_string, json_value_add_string_vec
269
294
end interface json_value_add
295
+ ! *************************************************************************************
270
296
297
+ ! *************************************************************************************
298
+ ! ****f* json_module/json_get
299
+ !
300
+ ! NAME
301
+ ! json_get
302
+ !
303
+ ! DESCRIPTION
304
+ ! Get data from a json_value linked list.
305
+ !
306
+ ! SOURCE
271
307
interface json_get
272
308
module procedure :: json_get_by_path
273
309
module procedure :: json_get_integer, json_get_integer_vec
@@ -276,6 +312,7 @@ end subroutine array_callback_func
276
312
module procedure :: json_get_chars, json_get_char_vec
277
313
module procedure :: json_get_array
278
314
end interface json_get
315
+ ! *************************************************************************************
279
316
280
317
interface json_print_to_string
281
318
module procedure :: json_value_to_string
@@ -1135,7 +1172,7 @@ end subroutine json_value_remove
1135
1172
! json_value_add_member
1136
1173
!
1137
1174
! DESCRIPTION
1138
- ! Adds the member to the linked list
1175
+ ! Adds the member as a child of this.
1139
1176
!
1140
1177
! SOURCE
1141
1178
0 commit comments