skphy / json-fortran

KISS Fortran routines to write (multi-dimensional) data as JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json-fortran

KISS Fortran routines to write (multi-dimensional) data as JSON

Example

program test_json
  use json

  call open_dbg_out("test.json")

  call add_int("a", 42)
  call add_int_1d("b", 3,       (/ 1, 2, 3 /) )
  call add_int_2d("c", 3, 2, (/ (/ 1, 2, 3 /), &
                                (/ 4, 5, 6 /) /) )

  call close_dbg_out()

end program

produces the following JSON output in test.json:

{"a":42,"b":[1,2,3],"c":[[1,2,3],[4,5,6]]}

Include into existing projects

Here is how you can add this project as a Git submodule into your code:

$ git submodule add git@github.com:jonathanschilling/json-fortran.git

In order to use this project in an existing CMake setup, simply include the following in your CMakeLists.txt:

add_subdirectory(json-fortran)

It you do not work on VMEC, you will have to adjust the vmec_sources array name in json-fortran's CMakeLists.txt.

About

KISS Fortran routines to write (multi-dimensional) data as JSON

License:Apache License 2.0


Languages

Language:Fortran 98.8%Language:Makefile 0.7%Language:CMake 0.5%