CSSON is a superset of JSON designed to make configuration and styling files more flexible. It allows:
- Comments (single line
//or jsdoc/* */) - Optional semicolons
- Units like
px,%,em - Hex colors
- Easy parsing and stringifying
Perfect for configs, themes, and dynamic settings in js projects.
Demo: Demo
- Allows comments
- css like syntax
- Can be parsed and stringified with js similar to json
- Case insensitive parser available (can be used as
CSSON.functorcsson.funct) - Lightweight and fast
Include via es Module:
import { CSSON } from "https://cdn.jsdelivr.net/gh/outbrowsed/csson@main/src/index.min.mjs";import { CSSON } from "https://cdn.jsdelivr.net/gh/outbrowsed/csson@main/src/index.min.mjs";
const text = `
theme {
color: #ff0000;
fontSize: 16px;
darkMode: true;
}
users [
"alice",
"bob"
]
`;
const parsed = CSSON.parse(text);
console.log(parsed);const obj = {
theme: { color: "#ff0000", fontSize: "16px", darkMode: true },
users: ["alice", "bob"]
};
const str = CSSON.stringify(obj);
console.log(str);- Comments
// this is a line comment
/* this is a block (jsdoc) comment */
theme {
color: #000;
}
- Units and colors
theme {
fontSize: 16px;
margin: 10%;
color: #ff00ff;
}
- Arrays
users [
"alice",
"bob",
"charlie"
]
- Case insensitive keys
THEME {
COLOR: #fff;
}
- Nested objects
- Mix of arrays and objects
- Supports all json primitive types + comments and units
- Case insensitive parsing:
CSSON.parsewill accept keys in any casing
AGPL v3 License © 2025 OutBrowsed https://www.gnu.org/licenses/agpl-3.0.txt