Add Comment

JSON does not support user-defined comments. However, a workaround is to add comments as key-value pairs in a JSON object. In the example below, we add comments in a JSON object using custom keywords such as "comment", "_comment", "comments", or any other descriptive keyword chosen by the user. When Chemistry Builder parses an input JSON file, these custom keywords are safely ignored, and only the required keywords will be matched and processed.

  {
      "params": {
        "thermodynamicFramework": "MSE (H3O+ ion)",
        "comments": "This is a comment", 
        "modelName": "testModel",
        "privateDatabanks": []
      "phases": [
        "liquid1",
        "vapor",
        "solid", 
        "liquid2"
      ],
        "inflows": [
            {
                "name": "H2O",
                "comment": "water is added" 
            },
	    { 
		"name": "NaCl"
	    },
            {
                "name": "CO2"
            },
            {
                "name": "N2"
            }, 
            {
                "name": "BENZENE", 
                "_comment": "comment here" 
                
            },
            {
                "name": "CaCO3"
            } 
        ]	
    }
}

Last updated