# cssjson

> Converts CSS to JSON and back.

Latest version **2.1.3** (published 2015-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install cssjson
pnpm add cssjson
yarn add cssjson
bun add cssjson
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.3 |
| Published | 2015-01-21 |
| First published | 2015-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 334 |
| Author | Aram Kocharyan https://github.com/aramk |
| Maintainers | farhadg |
| Keywords | css, json, json, to, css, json, to, css, converter |

## Links

- npm: https://www.npmjs.com/package/cssjson
- Repository: https://github.com/aramk/CSSJSON
- Issues: https://github.com/aramk/CSSJSON/issues
- npm.io page: https://npm.io/package/cssjson

## 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

- 2.1.3 (latest) — 2015-01-21
- 2.1.2 — 2015-01-21
- 2.1.1 — 2015-01-21

## README

# CSS-JSON Converter for JavaScript

CSS-JSON Converter for JavaScript
Converts CSS to JSON and back.

Version 2.1.3

Released under the MIT license.

## Usage

	// To JSON
	var json = CSSJSON.toJSON(cssString);

	// To CSS
	var css = CSSJSON.toCSS(jsonObject);

## Sample

See example.html

### JSON

    {
      "children": {
        "@media (max-width: 800px)": {
          "children": {
            "#main #comments": {
              "children": {},
              "attributes": {
                "margin": "0px",
                "width": "auto",
                "background": "red"
              }
            },
            "#main #buttons": {
              "children": {},
              "attributes": {
                "padding": "5px 10px",
                "color": "blue"
              }
            }
          },
          "attributes": {}
        },
        "#main #content": {
          "children": {},
          "attributes": {
            "margin": "0 7.6%",
            "width": "auto"
          }
        },
        "#nav-below": {
          "children": {},
          "attributes": {
            "border-bottom": "1px solid #ddd",
            "margin-bottom": "1.625em",
            "background-image": "url(http://www.example.com/images/im.jpg)"
          }
        }
      },
      "attributes": {}
    }

### CSS

    @media (max-width: 800px) {
        #main #comments {
            margin: 0px;
            width: auto;
            background: red;
        }
        #main #buttons {
            padding: 5px 10px;
            color: blue;
        }
    }
    #main #content {
        margin: 0 7.6%;
        width: auto;
    }
    #nav-below {
        border-bottom: 1px solid #ddd;
        margin-bottom: 1.625em;
        background-image: url(http://www.example.com/images/im.jpg);
    }

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