# wdf-to-json

> JangoMail Web DB Format to JSON

Latest version **0.0.3** (published 2018-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install wdf-to-json
pnpm add wdf-to-json
yarn add wdf-to-json
bun add wdf-to-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-10-15 |
| First published | 2018-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Erickson G. Pece |
| Maintainers | jangomail |

## Links

- npm: https://www.npmjs.com/package/wdf-to-json
- npm.io page: https://npm.io/package/wdf-to-json

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^4.1.0

## Recent versions

- 0.0.3 (latest) — 2018-10-15

## README

# jm-wdf-to-json

This package contains the code necessary to convert the JangoMail Web DB Format to JSON.

## Contributing

Review the  [Contributing Guidelines](CONTRIBUTING.md)  before making changes

## Install

### Latest version

`npm install https://bitbucket.org/jangocode/jm-wdf-to-json.git`

### Specific version

`npm install https://bitbucket.org/jangocode/jm-wdf-to-json.git\#0.0.1`

_(where 0.0.1 is the tagged version)_

## Example

```
const wdfToJson = require('jm-wdf-to-json');

let data = 'EmailAddress,FirstName,LastName___ASDF---BREAKjohn@example.comWG0COLWG0JohnWG0COLWG0DoeWG0ROWWG0WANGO-ENDOFDATASTREAM';

try {
  let json = wdfToJson.parse(data);

  console.log(JSON.stringify(json));
} catch (err) {
  console.error(err);
}
```

## Terms

### WDF

Web DB Format

## Background

When making a connection to a web database, JangoMail uses a custom format to define the header, rows, columns, and data end.

### Header

The header is comprised of a comma separated list of strings, with `___ASDF---BREAK` appended to the end.

### Data

The data is column delimited by `WG0COLWG0` and row delimited by `WG0ROWWG0`.

### File End

The end of the file is marked by a final `WANGO-ENDOFDATASTREAM`.

## Example

Using this example:

| EmailAddress | FirstName | LastName |
| --- | --- | --- |
| john@example.com | John | Doe |
| jane@example.com | Jane | Doe |
| alice@example.com | Alice | Smith |

This is how this would represented in `WDF` (without newline breaks as shown in this example):

```
EmailAddress,FirstName,LastName___ASDF---BREAK
john@example.comWG0COLWG0JohnWG0COLWG0DoeWG0ROWWG0
jane@example.comWG0COLWG0JaneWG0COLWG0DoeWG0ROWWG0
alice@example.comWG0COLWG0AliceWG0COLWG0SmithWG0ROWWG0
WANGO-ENDOFDATASTREAM
```

And this is what this module will convert it to:

```
[
  {
    "EmailAddress": "john@example.com",
    "FirstName": "John",
    "LastName": "Doe"
  },
  {
    "EmailAddress": "jane@example.com",
    "FirstName": "Jane",
    "LastName": "Doe"
  },
  {
    "EmailAddress": "alice@example.com",
    "FirstName": "Alice",
    "LastName": "Smith"
  }
]
```

---
_Source: https://npm.io/package/wdf-to-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
