Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@ajkachnic/jason
Advanced tools
`jason` is a JSON parser and formatter written in JavaScript. It's pretty simple (220 lines with comments and blank lines) and should be pretty fast. It uses [`moo`](https://github.com/no-context/moo) for lexing, and then iterates over that stream of toke
jason
jason
is a JSON parser and formatter written in JavaScript. It's pretty simple (220 lines with comments and blank lines) and should be pretty fast. It uses moo
for lexing, and then iterates over that stream of tokens. It supports proper strings, floats, and some pretty errors. It's kinda pointless because JSON.parse
exists, but interesting nonetheless.
npm install @ajkachnic/jason
You can selectively import the functions you want using destructuring
Here's a typescript example:
import { parse, format, beautify } from '@ajkachnic/jason'
And here's a commonjs version:
const { parse, format, beautify } = require('@ajkachnic/jason')
parse
parse
takes a string and returns it's JavaScript equivalent.
Example:
const output = parse('{ "name": "bob", "age": 28.5 }') // { name: "bob", age: 28.5 }
format
format
takes a JavaScript value and returns it's JSON encoded counterpart. Please only pass this things that will be properly encoded (class instances and stuff won't be)
It also has a second optional argument for whether or not to pretty-print. This is set to false by default
Example:
const json = format({ name: "bob", age: 28.5 }) // {"name":"bob","age":28.5}
beautify
beautify
takes a JSON string and returns a pretty-printed version. It basically just parses it and then runs format
on it with pretty printing enabled. It's probably not very fast
Example:
const beautified = beautify('{"name":"bob","age":28.5}') // { "name": "bob", "age": 28.5 }
FAQs
`jason` is a JSON parser and formatter written in JavaScript. It's pretty simple (220 lines with comments and blank lines) and should be pretty fast. It uses [`moo`](https://github.com/no-context/moo) for lexing, and then iterates over that stream of toke
The npm package @ajkachnic/jason receives a total of 3 weekly downloads. As such, @ajkachnic/jason popularity was classified as not popular.
We found that @ajkachnic/jason demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.