# qs-to-json

> ![](https://img.shields.io/circleci/project/github/neha-saggam/qs-to-json.svg) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/1abcd6501f6b4213b01c920aa7d8febb)](https://app.codacy.com/gh/neha-saggam/qs-to-json/dashboard?utm_source=gh&utm_medi

Latest version **0.1.11** (published 2023-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install qs-to-json
pnpm add qs-to-json
yarn add qs-to-json
bun add qs-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.1.11 |
| Published | 2023-06-10 |
| First published | 2019-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Neha Saggam & Vivek Jain |
| Maintainers | nehasaggam |
| Keywords | querystring, json, parse, url, query, javascriptobject, query string to json, query paramaters, parameters, params, query string to javascript |

## Links

- npm: https://www.npmjs.com/package/qs-to-json
- Repository: https://github.com/neha-saggam/qs-to-json
- Issues: https://github.com/neha-saggam/qs-to-json/issues
- npm.io page: https://npm.io/package/qs-to-json

## 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.1.11 (latest) — 2023-06-10
- 0.1.10 — 2023-06-10
- 0.1.9 — 2020-08-30
- 0.1.8 — 2020-08-30
- 0.1.7 — 2020-08-30
- 0.1.6 — 2020-08-28
- 0.1.5 — 2020-07-15
- 0.1.4 — 2020-07-04
- 0.1.3 — 2020-07-04
- 0.1.2 — 2019-08-29
- 0.1.1 — 2019-06-16
- 0.1.0 — 2019-05-20

## README

# Query String to JSON

![](https://img.shields.io/circleci/project/github/neha-saggam/qs-to-json.svg) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/1abcd6501f6b4213b01c920aa7d8febb)](https://app.codacy.com/gh/neha-saggam/qs-to-json/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/1abcd6501f6b4213b01c920aa7d8febb)](https://app.codacy.com/gh/neha-saggam/qs-to-json/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)

Library to parse given _decoded_ query string and create a JSON object.

## Installation

Install qs-to-json using [`npm`](https://www.npmjs.com/):

```bash
npm install --save-dev qs-to-json
```

## Example

**NOTE:** : qs-to-json currently does not decode the query string. Make sure you pass decoded queryString.

1.  Convert "&a=1&b=2" to a JSON object:

```javascript
import queryStringToJSON from "qs-to-json";

const queryString = "&a=1&b=2";
const json = queryStringToJSON(queryString);
console.log(json);
```

Output would be the following:

```json
{
  "a": "1",
  "b": "2"
}
```

2.  Convert "&a[]=1&a[]=2" to a JSON object:

```javascript
import queryStringToJSON from "qs-to-json";

const queryString = "&a[]=1&a[]=2";
const json = queryStringToJSON(queryString);
console.log(json);
```

Output would be the following:

```json
{
  "a": ["1", "2"]
}
```

2.  Convert "a.name=Nick&b.name=John" to a JSON object:

```javascript
import queryStringToJSON from "qs-to-json";

const queryString = "a.name=Nick&b.name=John";
const json = queryStringToJSON(queryString);
console.log(json);
```

Output would be the following:

```json
{
  "a": { "name": "Nick" },
  "b": { "name": "John" }
}
```

## Playground

[Demo](https://neha-saggam.github.io/qs-to-json-gh-pages/)

## Contributing

We accept pull requests :D

## License

qs-to-json is [MIT licensed](./LICENSE).

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