English
OK JSON
OK JSON is a JSON viewer. Protocol Launcher allows you to generate OK JSON URL scheme links.
Usage
There are two ways to use this library:
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
- Full Import from the root package is convenient but includes all app modules.
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
Select Installation Method
On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.
Notes
The official reference now lists seven actions, including download and curl. These read the clipboard; curl executes the command it contains.
newJson() accepts a raw JSON string and serializes it as the official URL-encoded content query parameter. runScript() accepts the custom script file name without the .js extension, matching the official script URL format.
View JSON String from Pasteboard
ts
import { paste } from 'protocol-launcher/ok-json'
const url = paste()View JSON String
ts
import { newJson } from 'protocol-launcher/ok-json'
const url = newJson({
content: '{"hello":"world"}',
})Show History Window
ts
import { history } from 'protocol-launcher/ok-json'
const url = history()Show Scripts Panel Window
ts
import { scriptsPanel } from 'protocol-launcher/ok-json'
const url = scriptsPanel()Run Script
ts
import { runScript } from 'protocol-launcher/ok-json'
const url = runScript({
scriptFileNameWithoutJsExtension: 'copy-minified-json',
})Download from Clipboard URL
Read the URL from the clipboard, download its content, and open it as JSON.
ts
import { download } from 'protocol-launcher/ok-json'
const url = download()Run Clipboard cURL
Execute the cURL command currently on the clipboard. Review that command before opening this URL.
ts
import { curl } from 'protocol-launcher/ok-json'
const url = curl()Generated URLs
ts
paste()
// => 'okjson://paste'
newJson({
content: '{"hello":"world"}',
})
// => 'okjson://new?content=%7B%22hello%22%3A%22world%22%7D'
history()
// => 'okjson://history'
scriptsPanel()
// => 'okjson://scripts-panel'
runScript({
scriptFileNameWithoutJsExtension: 'copy-minified-json',
})
// => 'okjson://script/copy-minified-json'