Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 396
    • Issues 396
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #2366
Closed
Open
Created Feb 14, 2022 by Henning Scheufler@Henning86

include json in openfoam dictionaries

@mark @kuti

Hi,

I created a functionEntry that allows embedding jsons in OpenFOAM dicts

https://github.com/HenningScheufler/ofjson

Usage

#json "<case>/test.json";

cat test.json:

{
    "string": "string",
    "istream": "istream;",
    "label": 10,
    "scalar": 10.1,
    "vector": [1.1, 2.2, 3.3],
    "subDict": {
        "sub_string": "string",
        "sub_istream": "istream;",
        "sub_label": 10,
        "sub_scalar": 10.1
    },
    "scalarField": {
        "type": "scalarField",
        "value": [1.1, 2.2, 3.3, 4.4]
    }
}

The standard OpenFOAM access patterns apply:

{
    $string; // would return string
    $scalar; // would return 10.1
}

Kind Regards,

Henning

Edited Feb 18, 2022 by Henning Scheufler
Assignee
Assign to
Time tracking