Package org.apache.commons.configuration2

## Class JSONConfiguration

- java.lang.Object
- - org.apache.commons.configuration2.event.BaseEventSource
  - - org.apache.commons.configuration2.AbstractConfiguration
    - - org.apache.commons.configuration2.AbstractHierarchicalConfiguration<ImmutableNode>
      - - org.apache.commons.configuration2.BaseHierarchicalConfiguration
        - - org.apache.commons.configuration2.AbstractYAMLBasedConfiguration
          - - org.apache.commons.configuration2.JSONConfiguration

- All Implemented Interfaces:
    `Cloneable`, `Configuration`, `EventSource`, `FileBasedConfiguration`, `HierarchicalConfiguration<ImmutableNode>`, `ImmutableConfiguration`, `ImmutableHierarchicalConfiguration`, `FileBased`, `InputStreamSupport`, `SynchronizerSupport`, `InMemoryNodeModelSupport`, `NodeKeyResolver<ImmutableNode>`, `NodeModelSupport<ImmutableNode>`

      public class JSONConfiguration
      extends AbstractYAMLBasedConfiguration
      implements FileBasedConfiguration, InputStreamSupport

  A specialized hierarchical configuration class that is able to parse JSON documents.

  Since:
    2.2

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.commons.configuration2.BaseHierarchicalConfiguration

      `BaseHierarchicalConfiguration.BuilderVisitor`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JSONConfiguration()` | Creates a new instance of `JSONConfiguration`.
    `JSONConfiguration​(HierarchicalConfiguration<ImmutableNode> c)` | Creates a new instance of `JSONConfiguration` as a copy of the specified configuration.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `read​(InputStream in)` | Loads the configuration from the given input stream.
    `void` | `read​(Reader in)` | Reads the content of this object from the given reader.
    `void` | `write​(Writer out)` | Writes the content of this object to the given writer.

    - ### Methods inherited from class org.apache.commons.configuration2.AbstractYAMLBasedConfiguration

      `constructMap, load`

    - ### Methods inherited from class org.apache.commons.configuration2.BaseHierarchicalConfiguration

      `childConfigurationsAt, childConfigurationsAt, cloneNodeModel, configurationAt, configurationAt, configurationsAt, configurationsAt, createSubConfigurationForTrackedNode, getNodeModel, getSubConfigurationNodeSelector, getSubConfigurationParentModel, immutableChildConfigurationsAt, immutableConfigurationAt, immutableConfigurationAt, immutableConfigurationsAt, initSubConfigurationForThisParent, interpolatedConfiguration, subnodeConfigurationChanged, subset`

    - ### Methods inherited from class org.apache.commons.configuration2.AbstractHierarchicalConfiguration

      `addNodes, addNodesInternal, addPropertyDirect, addPropertyInternal, clearInternal, clearPropertyDirect, clearTree, clearTreeInternal, clone, containsKeyInternal, fetchNodeList, getExpressionEngine, getKeysInternal, getKeysInternal, getMaxIndex, getMaxIndexInternal, getModel, getPropertyInternal, getRootElementName, getRootElementNameInternal, isEmptyInternal, nodeDefined, nodeKey, resolveAddKey, resolveKey, resolveNodeKey, resolveUpdateKey, setExpressionEngine, setPropertyInternal, sizeInternal, toString`

    - ### Methods inherited from class org.apache.commons.configuration2.AbstractConfiguration

      `addErrorLogListener, addProperty, append, beginRead, beginWrite, clear, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getDuration, getDuration, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setSynchronizer, setThrowExceptionOnMissing, size, unlock`

    - ### Methods inherited from class org.apache.commons.configuration2.event.BaseEventSource

      `addEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.commons.configuration2.Configuration

      `addProperty, clear, clearProperty, getInterpolator, installInterpolator, setInterpolator, setProperty, subset`

    - ### Methods inherited from interface org.apache.commons.configuration2.ImmutableConfiguration

      `containsKey, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getDouble, getDouble, getDouble, getDuration, getDuration, getEncodedString, getEncodedString, getEnum, getEnum, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, immutableSubset, isEmpty, size`

    - ### Methods inherited from interface org.apache.commons.configuration2.sync.SynchronizerSupport

      `getSynchronizer, lock, setSynchronizer, unlock`

- - ### Constructor Detail

    - #### JSONConfiguration

          public JSONConfiguration()

      Creates a new instance of `JSONConfiguration`.

    - #### JSONConfiguration

          public JSONConfiguration​(HierarchicalConfiguration<ImmutableNode> c)

      Creates a new instance of `JSONConfiguration` as a copy of the specified configuration.
      Parameters:
        `c` - the configuration to be copied

  - ### Method Detail

    - #### read

          public void read​(Reader in)
                    throws ConfigurationException

      Description copied from interface: `FileBased`
      Reads the content of this object from the given reader. Client code should not call this method directly, but use a `FileHandler` for reading data.
      Specified by:
        `read` in interface `FileBased`
      Parameters:
        `in` - the reader
      Throws:
        `ConfigurationException` - if a non-I/O related problem occurs, e.g. the data read does not have the expected format

    - #### write

          public void write​(Writer out)
                     throws ConfigurationException,
                            IOException

      Description copied from interface: `FileBased`
      Writes the content of this object to the given writer. Client code should not call this method directly, but use a `FileHandler` for writing data.
      Specified by:
        `write` in interface `FileBased`
      Parameters:
        `out` - the writer
      Throws:
        `ConfigurationException` - if a non-I/O related problem occurs, e.g. the data read does not have the expected format
        `IOException` - if an I/O error occurs.

    - #### read

          public void read​(InputStream in)
                    throws ConfigurationException

      Loads the configuration from the given input stream.
      Specified by:
        `read` in interface `InputStreamSupport`
      Parameters:
        `in` - the input stream
      Throws:
        `ConfigurationException` - if an error occurs