# json-flat-pack-loader

> A json loader that flattens along the way.

Latest version **0.0.1** (published 2017-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-flat-pack-loader
pnpm add json-flat-pack-loader
yarn add json-flat-pack-loader
bun add json-flat-pack-loader
```

## 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.1 |
| Published | 2017-11-15 |
| First published | 2017-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | brenden snyder |
| Maintainers | brendens |
| Keywords | webpack, loader, json, flat json |

## Links

- npm: https://www.npmjs.com/package/json-flat-pack-loader
- Repository: https://github.com/edufii/json-flat-pack-loader
- Issues: https://github.com/edufii/json-flat-pack-loader
- npm.io page: https://npm.io/package/json-flat-pack-loader

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-11-15

## README

JSON Flat Pack Loader
=====================
[![npm version](https://badge.fury.io/js/json-float-pack-loader.svg)](https://badge.fury.io/js/json-float-pack-loader)

This webpack loader flattens out JSON into '.' delimited key value pairs before it is written to a file. This is useful for when you would like to store structured data but
a library requires flattend key value pairs such as [react-intl](https://github.com/yahoo/react-intl).

**Before**
```json
{
  "buttons": {
    "sign-in": "Sign In",
    "go-back": "Go Back"
  },
  "errors": {
    "account-not-found": "no account was not found matching the email and password provided"
  }
}
```

**After**
```json
{
  "buttons.sign-in": "Sign In",
  "buttons.go-back": "Go Back",
  "errors.account-not-found": "no account was not found matching the email and password provided" 
}
```

# Install
```bash
npm install --save-dev json-flat-pack-loader
```

# Usage
Use the loader either via your webpack config, CLI or inline.

## Webpack config
**webpack.config.js**
```js
module.exports = {
  module: {
    rules: [
      { test: /\.json$/, use: 'json-flat-pack-loader' }
    ]
  }
};
```

**In your application**
```js
import json from './file.json'
```

## CLI
```bash
webpack --module-bind 'json=json-flat-pack-loader'
```

**In your application**
```js
import json from 'file.json';
```

## Inline
**In your application**
```js
import json from 'json-flat-pack-loader!./file.json';

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