> For the complete documentation index, see [llms.txt](https://cfconfig.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cfconfig.ortusbooks.com/using-the-services/api-overview.md).

# API Overview

**Create a new JSON configuration file programmatically**

```javascript
JSONConfig = new path.to.JSONConfig()
    .setNullSupport( true )
    .setUseTimeServer( true )
    .setAdminPassword( 'myPass' )
    .addCFMapping( '/foo', '/bar' )
    .write();
```

**Read an existing JSON configuration file**

```javascript
JSONConfig = new path.to.JSONConfig()
    .read( 'test.json' );
```

**Read an existing Lucee 4 server configuration file**

```javascript
lucee4ServerConfig = new path.to.Lucee4ServerConfig()
    .setCFHomePath( expandPath( '/path/to/lucee-server' ) )
    .read();

writeDump( lucee4ServerConfig.getMemento() );
```

**Read an existing JSON config file and load into a Lucee 5 web context**

```javascript
JSONConfig = new path.to.JSONConfig()
    .read( expandPath( '.CFConfig.json' ) );

new path.to.Lucee4WebConfig()
    .setMemento( JSONConfig.getMemento() )        
    .write( expandPath( 'WEB-INF/lucee/' ) );
```

### Notes

The `JSONConfig` will read/write to a JSON file called `.CFConfig.json` by default in the home directory you specify. You can alternatively specify a full path to a JSON file to change the name.

The Lucee 4 and Lucee 5 *web* components expect the `CFHomePath` to be the folder containing the `lucee-web.xml.cfm` file.\
An example would be:

```
<webroot>/WEB-INF/lucee/
```

The Lucee 4 and Lucee 5 *server* components expect the `CFHomePath` to be the `lucee-server` folder containing the `/context/lucee-server.xml` file.\
An example would be:

```
/opt/lucee/lib/lucee-server/
```

The Adobe components expect the `CFHomePath` to be the `cfusion` folder that contains the `lib/neo-runtime.xml` file.\
An example would be:

```
C:/ColdFusion11/cfusion/
```

The code in this library has only been tested on Lucee and likely doesn't work on Adobe ColdFusion. If anyone wants to make it compatible, feel free to try by beware of tons of use of the Elvis operator, reliance on sorted JSON structs, and some specific WDDX behavior.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cfconfig.ortusbooks.com/using-the-services/api-overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
