.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEChem

.. oe:function:: OEWriteMonomerSet

   .. attention::

      |PRELIMINARY-API|

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEWriteMonomerSet(const OEMonomerSet& monomers,
                                const std::string& jsonFileName)

   .. oe:language:: python

      .. oe:api:: python

         OEWriteMonomerSet(monomers: OEMonomerSet, jsonFileName: str) -> bool

   Writes the monomer definitions stored in the monomer set (:oe:cls:`OEChem::OEMonomerSet`) into a JSON format.

   The following example shows how a monomer is represented in the output file:

   .. code-block:: bash

      {
        "smiles": "[H:1]N(C)[C@@H](Cc1ccccc1)C(=O)[OH:2]",
        "name": "N-alpha-methyl-L-Phenylalanine",
        "codes": {
           "OpenEye": "MeF",
           "PDB": "MEA"
        }
      },
   
   The :oe:const:`OEChem::OEPolymerType::Peptide` and :oe:const:`OEChem::OEMonomerType::Backbone`
   are considered defaults for a monomer and are only written to the json file if their 
   values differ from these defaults.

   .. only:: oehtml

      .. admonition::  See more example in the the following file:

         :download:`monomers-openeye.json <../../../../../sublibs/tklibs/oechem/peptide/data/monomers-openeye.json>`
   