https://github.com/tool3/pj
ℙⅉ pretty json using prismjs and query paramters
https://github.com/tool3/pj
json prismjs
Last synced: about 1 month ago
JSON representation
ℙⅉ pretty json using prismjs and query paramters
- Host: GitHub
- URL: https://github.com/tool3/pj
- Owner: tool3
- Created: 2020-07-08T18:53:56.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T09:13:07.000Z (over 4 years ago)
- Last Synced: 2025-03-21T13:54:10.610Z (about 1 year ago)
- Topics: json, prismjs
- Language: JavaScript
- Homepage: https://p-j.netlify.app/
- Size: 1.63 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

make pretty json using prismjs and query paramters
# description
PJ's single API route allows to create a single HTML page with prismjs already included, making it perfect for `iframe`s and quickly embedding highlighted JSON whether it's on READMEs, blogs, portfolio sites, or anything that can render html.
# usage
use the `/json` path with query parameters to control the content of the returned document.
# `GET /json?key=value`
for example, `https://p-j.herokuapp.com/json?hello=world&books=["cool","stuff"]&objects={"name":{"nested":true,"origin":null,"next":22}}`
will result in

## all types supported
`pj` supports all the json standard types: `string`, `number`, `boolean`, `null`, `objects` and `arrays`.
you can even have nested types ! (for example: `["item1", "item2", {"nested": true}]`)
## show line numbers
adding `showLineNumbers=true` will show line numbers on the returned highlighted code block.
## theme
adding `theme=` will use that theme to render the json.
available themes are the standard prismjs themes, which are:
- `coy`
- `dark`
- `funky`
- `okaidia`
- `solarizedlight`
- `tomorrow`
- `twilight`
note that there is no need to add the `prism-` prefix or any `.css` `.min.css` to the theme name as it is automatically added.