• Stars
    star
    331
  • Rank 127,323 (Top 3 %)
  • Language
    Fortran
  • License
    Other
  • Created almost 11 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Modern Fortran JSON API

JSON-Fortran

JSON-Fortran: A Modern Fortran JSON API

Table of Contents

Status

Build Status GitHub issues Codecov last-commit

Take a look at the CHANGELOG for a list of changes since the latest release.

top

Brief description

JSON-Fortran is a user-friendly, thread-safe, and object-oriented API for reading and writing JSON files, written in modern Fortran.

top

Download

GitHub release homebrew version Conda (channel only)

Download the official versioned releases here. Or, get the latest development code from the master branch here.

NEWS: As of June 7, 2015, json-fortran can be downloaded and installed with the homebrew package manager on Mac OS X. Once homebrew is installed, make sure that the formulae are up to date, view the package options and caveats, and install the json-fortran formula:

brew update
brew info json-fortran
brew install --with-unicode-support json-fortran

Please note, if you wish to support usage of JSON-Fortran with multiple Fortran compilers, please follow the CMake installation instructions below, as the homebrew installation is only intended to support a single Fortran compiler. Cheers!

NEWS: As of January 20, 2022, json-fortran can be downloaded and installed via the conda package manager on Mac OS X and Linux. Once a conda-distribution, like miniforge, is installed the json-fortran package can be installed.

conda install json-fortran

Note: Packages on conda-forge are build with GCC 9.4 which is upwards compatible with newer GCC versions, but not with other Fortran compilers.

top

Building the library

The code requires a Fortran compiler that supports various Fortran 2003 and Fortran 2008 features such as: allocatable strings, newunit, generic, class, and abstract interface. It has been successfully compiled with the Intel Fortran compiler 13.1.0 (and greater) and the GNU gfortran compiler [4.9 and greater]. It has also been reported that the library can be built (using the CMake build script) with the NAG Fortran compiler 6.0

Currently, several ways are provided to build the JSON-fortran library (libjsonfortran).

  • A build script, build.sh is provided in the project root directory. This script uses FoBiS to build the JSON-Fortran library and the unit tests on Unix-like systems. Edit the script to use either the Intel Fortran Compiler or Gfortran. Note that version 1.2.5 of FoBiS (or later) is required.

  • A FoBiS configuration file (json-fortran.fobis) is also provided that can also build the library and examples. Use the mode flag to indicate what to build. For example:

    • To build all the examples using gfortran: FoBiS.py build -f json-fortran.fobis -mode tests-gnu
    • To build all the examples using ifort: FoBiS.py build -f json-fortran.fobis -mode tests-intel
    • To build a static library using gfortran: FoBiS.py build -f json-fortran.fobis -mode static-gnu
    • To build a static library using ifort: FoBiS.py build -f json-fortran.fobis -mode static-intel

    The full set of modes are: static-gnu, static-gnu-debug, static-intel, static-intel-debug, shared-gnu, shared-gnu-debug, shared-intel, shared-intel-debug, tests-gnu, tests-gnu-debug, tests-intel, tests-intel-debug

    To generate the documentation using ford, run: FoBis.py rule --execute makedoc -f json-fortran.fobis

    To run all the tests, run: FoBis.py rule --execute tests -f json-fortran.fobis

  • A Visual Studio project is included for building the library (and unit tests) on Windows with the Intel Fortran Compiler. The project has been tested with Visual Studio 2010 and 2013.

  • A CMake build system is provided. This build system has been tested on Mac and Linux using the Intel Fortran Compiler, gfortran 4.9, and NAG Fortran 6.0. It does also work on Windows (but note that the Visual Studio project it generates is not quite the same as the one mentioned above). This CMake based build provides an install target, and exports from both the install location and the build location so that building and using JSON-Fortran in another CMake based project is trivial. To get started with the CMake based build, set the environment variable FC to point to your Fortran compiler, and create a build directory. Then (cmake-gui|ccmake|cmake) /path/to/json-fortran-root to configure, make to build and make install to optionally install. You can also use make check to build and run the unit tests. As long as the project is built with CMake, other CMake projects can find it and link against it. For example, if you have a second copy of the JSON-Fortran project tree, and want to build the unit tests linking against those compiled/installed by the first copy:

cmake_minimum_required ( VERSION 2.8.8 FATAL_ERROR )
enable_language ( Fortran )
project ( jf_test NONE )

find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 8.3.0 REQUIRED )

file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.F90" )
foreach ( UNIT_TEST ${JF_TEST_SRCS} )
  get_filename_component ( TEST ${UNIT_TEST} NAME_WE )
  add_executable ( ${TEST} ${UNIT_TEST} )
  target_link_libraries ( ${TEST} jsonfortran::jsonfortran-static )
  # or for linking against the dynamic/shared library:
  # target_link_libraries ( ${TEST} jsonfortran::jsonfortran ) # instead
endforeach()

top

Documentation

The API documentation for the latest release version can be found here. The documentation can also be generated by processing the source files with FORD. Note that both the shell script and CMake will also generate these files automatically in the documentation folder, assuming you have FORD installed.

Some examples can also be found on the wiki.

top

Contributing

Want to help? Take a quick look at our contributing guidelines then claim something and Fork. Commit. Pull request.

top

License

The JSON-Fortran source code and related files and documentation are distributed under a permissive free software license (BSD-style). See the LICENSE file for more details.

top

Miscellaneous

  • JSON-Fortran is a fork and extensive upgrade of the Fortran 95 FSON code. The reason for the split was to be able to incorporate object-oriented and other nice features of the Fortran 2003 and 2008 standards. Many thanks to the original authors of FSON.
  • For more information about JSON, see: http://www.json.org/
  • json-fortran on Codecov.IO

top

More Repositories

1

pyplot-fortran

For generating plots from Fortran using Python's matplotlib.pyplot πŸ“ˆ
Fortran
191
star
2

Fortran-Astrodynamics-Toolkit

A Modern Fortran Library for Astrodynamics πŸš€
Fortran
170
star
3

bspline-fortran

Multidimensional B-Spline Interpolation of Data on a Regular Grid
Fortran
165
star
4

csv-fortran

Read and Write CSV Files Using Modern Fortran
Fortran
94
star
5

slsqp

Modern Fortran Edition of the SLSQP Optimizer
Fortran
87
star
6

rklib

Fixed and variable-step Runge-Kutta solvers in Modern Fortran
Fortran
71
star
7

NumDiff

Modern Fortran Numerical Differentiation Library
Fortran
65
star
8

quadpack

Modern Fortran QUADPACK Library for 1D numerical quadrature
Fortran
61
star
9

finterp

Multidimensional (1D-6D) Linear and Nearest-Neighbor Interpolation with Modern Fortran
Fortran
54
star
10

dop853

Modern Fortran Edition of Hairer's DOP853 ODE Solver. An explicit Runge-Kutta method of order 8(5,3) for problems y'=f(x,y); with dense output of order 7
Fortran
47
star
11

odepack

Work in Progress to refactor and modernize the ODEPACK Library
Fortran
44
star
12

nlesolver-fortran

Nonlinear Equation Solver with Modern Fortran
Fortran
37
star
13

pikaia

Modern Fortran Edition of the Pikaia Genetic Algorithm
Fortran
35
star
14

PowellOpt

Optimization algorithms by M.J.D. Powell
Fortran
35
star
15

roots-fortran

A modern Fortran library for finding the roots of continuous scalar functions of a single real variable, using derivative-free methods.
Fortran
34
star
16

quadrature-fortran

1D-6D Adaptive Gaussian Quadrature with Modern Fortran
Fortran
34
star
17

ddeabm

Modern Fortran implementation of the DDEABM Adams-Bashforth algorithm
Fortran
33
star
18

fortran_function_parser

Modern Fortran function parser. An update of "fparser" by Roland Schmehl
Fortran
32
star
19

flist

Modern Fortran Linked List
Fortran
31
star
20

PCHIP

Modern Fortran Piecewise Cubic Hermite Interpolation Package
Fortran
25
star
21

nswc

NSWC Mathematics Subroutine Library
Fortran
24
star
22

daglib

Directed Acyclic Graphs With Modern Fortran
Fortran
24
star
23

fortran-search-and-sort

Searching and sorting with modern Fortran
C++
24
star
24

LSQR

Modern Fortran sparse linear systems solver
Fortran
23
star
25

stl-fortran

Fortran STL File I/O
Fortran
22
star
26

simulated-annealing

Simulated Annealing with Modern Fortran
Fortran
22
star
27

polyroots-fortran

Modern Fortran library for finding the roots of real and complex polynomial equations
Fortran
22
star
28

matlab

Fortran
20
star
29

stringsort

Modern Fortran sorting routines for strings
Fortran
18
star
30

FGIF

Create Animated GIFs with Fortran
Fortran
16
star
31

astro-fortran

Modern Fortran implementations of standard models used in fundamental astronomy
Fortran
16
star
32

carlson-elliptic-integrals

Carlson symmetric forms of elliptic integrals
Fortran
14
star
33

regridpack

Modern Fortran Edition of REGRIDPACK
Fortran
13
star
34

CMLIB

NBS Core Math Library (CMLIB) Unofficial Mirror
Fortran
13
star
35

namelist2json

Converting a Fortran namelist to JSON
Fortran
12
star
36

halo

Halo orbit solver with modern Fortran
Fortran
10
star
37

uuid-fortran

Fortran module for generating UUIDs
Fortran
9
star
38

splpak

Modernized SPLPAK library for multidimensional least-squares cubic spline fitting
Fortran
8
star
39

fortran-json-python

Interfacing Fortran and Python via JSON
Fortran
8
star
40

math77

Unofficial Mirror of the JPL MATH77 Library
Fortran
8
star
41

LOM

Low Lunar Orbit Maintenance
Fortran
7
star
42

lbfgsb

Modern Fortran Refactoring of L-BFGS-B Nonlinear Optimization Code
Fortran
7
star
43

specfun

Special functions with Modern Fortran
Fortran
7
star
44

HOMPACK90

Unofficial mirror of HOMPACK90 from http://people.cs.vt.edu/~ltw/hompack/hompack90.html
Fortran
7
star
45

geodesic-fortran

Geodesic routines for Modern Fortran
Fortran
6
star
46

argv-fortran

A better get_command_argument for Fortran
Fortran
6
star
47

fastnml

Python module for reading and writing Fortran namelists
Python
6
star
48

mersenne-twister-fortran

Mersenne Twister pseudorandom number generator for Fortran
Fortran
5
star
49

fmin

Derivative free 1D function minimizer in modern Fortran
Fortran
5
star
50

LSMR

Fortran Package Manager version of LSMR: Sparse Equations and Least Squares
Fortran
5
star
51

kronrod

Program for generating Gauss-Kronrod Coefficients
Fortran
5
star
52

INPE-atmosphere-models

Fortran code for various atmosphere modes from http://www.dem.inpe.br/~val/atmod/default.html
Fortran
5
star
53

rksuite

Unofficial mirror of RKSUITE http://www.netlib.org/ode/rksuite/
Fortran
5
star
54

dvode

Modern Fortran Edition of the DVODE ODE Solver
Fortran
4
star
55

AoC-2023

Advent of Code 2023 with Modern Fortran
Fortran
4
star
56

FMLIB

Unofficial mirror of FMLIB for Multiple Precision Computations
Fortran
4
star
57

FilterSD

Unofficial mirror of FilterSD https://github.com/coin-or/filterSD
Fortran
3
star
58

conmax

Modern Fortran CONMAX Optimization Method for general nonlinearly constrained function minimization
Fortran
3
star
59

radbelt

AE-8/AP-8 Van Allen belt model in modern Fortran
Fortran
3
star
60

1976-standard-atmosphere

1976 Standard Atmosphere in Modern Fortran
Fortran
3
star
61

AoC-2021

Advent of Code 2021 with Fortran.
Fortran
3
star
62

MPFUN2015

Unofficial Mirror of MPFUN2015 from https://www.davidhbailey.com/dhbsoftware/
Fortran
3
star
63

popen-fortran

Simple Fortran module for popen
Fortran
3
star
64

IAU_SOFA

Unofficial Mirror of the IAU SOFA Fortran Library
Fortran
2
star
65

divalib

DIVA integrator from MATH77
Fortran
2
star
66

diff

Numerical Differentiation of a User Defined Function
Fortran
2
star
67

StatLib

Unofficial mirror of StatLib http://lib.stat.cmu.edu/apstat/
Fortran
2
star
68

dfo

Unofficial mirror of DFO: https://projects.coin-or.org/Dfo
Fortran
2
star
69

mpfun2020-var1

FPM Package for MPFUN2020 (var1) https://www.davidhbailey.com/dhbsoftware/
Fortran
2
star
70

fortran-mach

Modern Fortran Machine Constants Module (r1mach, d1mach, i1mach)
Fortran
1
star
71

MPFUN2020

Unofficial Mirror of MPFUN2020 from https://www.davidhbailey.com/dhbsoftware/
Fortran
1
star
72

NOVAS

Refactoring of NOVAS: Naval Observatory Vector Astrometry Subroutines
Fortran
1
star
73

SofaMerge

A simple script to make one module from all the SOFA files
Python
1
star
74

AoC-2022

Advent of Code 2022 in Fortran
Fortran
1
star
75

ffp

Unofficial mirror of Fortran Function Parser from http://www.labfit.net/functionparser.htm
Fortran
1
star
76

NRLMSIS2.1

Unofficial Mirror of NRLMSIS2.1 https://map.nrl.navy.mil/map/pub/nrl/NRLMSIS/NRLMSIS2.1/
Fortran
1
star