json-toon-parser 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -35
- package/package.json +72 -11
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# json-toon-parser
|
|
2
2
|
|
|
3
|
-
**Version:** 1.1.
|
|
3
|
+
**Version:** 1.1.3 • **License:** MIT • **Format:** TOON
|
|
4
4
|
|
|
5
5
|
High-efficiency conversion and analysis toolkit: JSON → TOON with CLI, API, and Web UI server for real‑time token savings. Ideal for reducing LLM prompt payload size and optimizing costs.
|
|
6
6
|
|
|
@@ -67,38 +67,104 @@ const toonString = jsonToToon({ hello: "world" });
|
|
|
67
67
|
- 🧪 GPT-style token counting via `gpt-3-encoder`
|
|
68
68
|
|
|
69
69
|
## API (Summary)
|
|
70
|
+
# json-toon-parser
|
|
71
|
+
|
|
72
|
+
[](https://www.npmjs.com/package/json-toon-parser)
|
|
73
|
+
[](https://www.npmjs.com/package/json-toon-parser)
|
|
74
|
+
[](https://opensource.org/licenses/MIT)
|
|
75
|
+
|
|
76
|
+
================================================================================
|
|
77
|
+
|
|
78
|
+
🚀 json-toon-parser — JSON → TOON converter, token optimizer, and developer toolkit
|
|
79
|
+
|
|
80
|
+
Convert verbose JSON into compact TOON, reduce LLM token usage, and measure savings.
|
|
81
|
+
|
|
82
|
+
Perfect for teams and engineers integrating large structured payloads into ChatGPT/OpenAI/Claude prompts or storage pipelines.
|
|
83
|
+
|
|
84
|
+
Official NPM package: https://www.npmjs.com/package/json-toon-parser
|
|
85
|
+
|
|
86
|
+
Documentation: `docs/API.md`
|
|
87
|
+
|
|
88
|
+
================================================================================
|
|
89
|
+
|
|
90
|
+
## Quick Install
|
|
91
|
+
|
|
92
|
+
Global (CLI + Web UI):
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm install -g json-toon-parser
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Programmatic (project):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install json-toon-parser
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Verify:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
json-toon --version
|
|
108
|
+
json-toon serve
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
================================================================================
|
|
70
112
|
|
|
71
|
-
|
|
113
|
+
## Why TOON? — The Value Proposition
|
|
72
114
|
|
|
73
|
-
|
|
74
|
-
Compare JSON data with TOON format and calculate token efficiency.
|
|
115
|
+
TOON is a compact, human-friendly serialization optimized for token-efficient LLM prompts. It removes syntactic noise (quotes, braces, commas), reduces repeated keys, and uses concise array and nesting notation — which directly translates to lower API costs and faster transmission.
|
|
75
116
|
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
- `outputDir`: Output directory (default: "output")
|
|
80
|
-
- `saveToFile`: Save TOON file (default: false)
|
|
81
|
-
- `prettyJson`: Pretty print JSON (default: true)
|
|
82
|
-
- `fileName`: Custom filename
|
|
117
|
+
- Reduce per-request token counts by 40–70% (depends on structure)
|
|
118
|
+
- Keep payloads human-readable and reversible via the TOON library
|
|
119
|
+
- Ideal for prompts, telemetry, logs, and mobile/edge transfers
|
|
83
120
|
|
|
84
|
-
|
|
121
|
+
================================================================================
|
|
122
|
+
|
|
123
|
+
## Features
|
|
85
124
|
|
|
86
|
-
|
|
87
|
-
|
|
125
|
+
- CLI: `serve`, `compare`, `convert`, `update`
|
|
126
|
+
- Web UI: interactive editor, samples, copy & download
|
|
127
|
+
- Programmatic API (TypeScript types included)
|
|
128
|
+
- Token analysis using `gpt-3-encoder` for GPT-style counts
|
|
129
|
+
- Save TOON output with timestamped filenames
|
|
88
130
|
|
|
89
|
-
|
|
90
|
-
Convert JSON file to TOON format and save.
|
|
131
|
+
================================================================================
|
|
91
132
|
|
|
92
|
-
|
|
93
|
-
Convert JSON data to TOON format string.
|
|
133
|
+
## Usage Examples
|
|
94
134
|
|
|
95
|
-
|
|
96
|
-
|
|
135
|
+
CLI
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Start web UI
|
|
139
|
+
json-toon serve
|
|
97
140
|
|
|
98
|
-
|
|
99
|
-
|
|
141
|
+
# Compare & save TOON
|
|
142
|
+
json-toon compare data/input.json --save
|
|
143
|
+
|
|
144
|
+
# Convert file
|
|
145
|
+
json-toon convert data/input.json output.toon
|
|
146
|
+
|
|
147
|
+
# Update JSON and produce comparison
|
|
148
|
+
json-toon update data/input.json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Programmatic
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { compare, jsonToToon } from 'json-toon-parser';
|
|
155
|
+
|
|
156
|
+
const data = { users: [{ id: 1, name: 'Alice' }] };
|
|
157
|
+
const toon = jsonToToon(data);
|
|
158
|
+
const result = compare(data, { saveToFile: false });
|
|
159
|
+
console.log(result.toonOutput);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
================================================================================
|
|
163
|
+
|
|
164
|
+
## Example Comparison
|
|
165
|
+
|
|
166
|
+
Use this example to demonstrate typical savings — include it in docs, blog posts, or README highlights:
|
|
100
167
|
|
|
101
|
-
## Example CLI Output
|
|
102
168
|
```
|
|
103
169
|
============================================================
|
|
104
170
|
COMPARISON RESULTS
|
|
@@ -111,24 +177,39 @@ Output File: output/data_DateTime.toon
|
|
|
111
177
|
============================================================
|
|
112
178
|
```
|
|
113
179
|
|
|
114
|
-
|
|
180
|
+
================================================================================
|
|
181
|
+
|
|
182
|
+
## When TOON Is Most Effective
|
|
183
|
+
|
|
184
|
+
- Nested JSON with many structural characters
|
|
185
|
+
- Large arrays of similar objects
|
|
186
|
+
- Repetitive keys repeated across objects
|
|
187
|
+
- Prompts that include large contexts for LLMs
|
|
115
188
|
|
|
116
|
-
|
|
117
|
-
- 💾 Payload Compression – Minimize size for storage or transfer
|
|
118
|
-
- 📊 Batch Conversion – Automate directory/file transformations
|
|
119
|
-
- 🛠️ CI Integration – Enforce efficiency gates in pipelines
|
|
120
|
-
- 📈 LLM Cost Reduction – Lower prompt token usage dramatically
|
|
189
|
+
================================================================================
|
|
121
190
|
|
|
122
|
-
##
|
|
191
|
+
## Performance Notes
|
|
123
192
|
|
|
124
|
-
-
|
|
193
|
+
Token counting is approximated with `gpt-3-encoder`. Results may vary slightly by tokenizers used by different LLM providers, but the relative savings are consistent.
|
|
125
194
|
|
|
126
|
-
|
|
195
|
+
================================================================================
|
|
127
196
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
197
|
+
## Links & Resources
|
|
198
|
+
|
|
199
|
+
- NPM: https://www.npmjs.com/package/json-toon-parser
|
|
200
|
+
- TOON format: https://github.com/toon-format/toon
|
|
201
|
+
- API docs: `docs/API.md`
|
|
202
|
+
|
|
203
|
+
================================================================================
|
|
204
|
+
|
|
205
|
+
## Contributing
|
|
206
|
+
|
|
207
|
+
See `CONTRIBUTING.md` to get started. We welcome PRs, issues, and ideas.
|
|
208
|
+
|
|
209
|
+
================================================================================
|
|
131
210
|
|
|
132
211
|
## License
|
|
133
212
|
|
|
134
213
|
MIT © Bhushan Chaudhari
|
|
214
|
+
|
|
215
|
+
================================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-toon-parser",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Compare and convert JSON to TOON format with token efficiency analysis – includes CLI, API, and Web UI server.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,25 +35,86 @@
|
|
|
35
35
|
],
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/
|
|
39
|
-
},
|
|
40
|
-
"homepage": "https://github.com/bhushan44/json-toon-parser#readme",
|
|
41
|
-
"bugs": {
|
|
42
|
-
"url": "https://github.com/bhushan44/json-toon-parser/issues"
|
|
38
|
+
"url": "git+https://github.com/bhushan020/json-toon-parser.git"
|
|
43
39
|
},
|
|
40
|
+
"homepage": "https://github.com/bhushan020/json-toon-parser#readme",
|
|
44
41
|
"keywords": [
|
|
45
42
|
"json",
|
|
46
|
-
"toon",
|
|
47
43
|
"parser",
|
|
48
44
|
"converter",
|
|
49
45
|
"tokenization",
|
|
46
|
+
"toon",
|
|
47
|
+
"toon-format",
|
|
48
|
+
"toon-parser",
|
|
49
|
+
"toon-tokenizer",
|
|
50
|
+
"json-to-toon",
|
|
51
|
+
"json-toon-parser",
|
|
52
|
+
"JSON-to-TOON",
|
|
50
53
|
"gpt",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"efficiency",
|
|
54
|
+
"llm",
|
|
55
|
+
"prompt-optimizer",
|
|
54
56
|
"token-optimization",
|
|
57
|
+
"token-efficiency",
|
|
58
|
+
"compression",
|
|
59
|
+
"data-compression",
|
|
60
|
+
"text-compression",
|
|
61
|
+
"minifier",
|
|
62
|
+
"custom-format",
|
|
63
|
+
"format-converter",
|
|
55
64
|
"webui",
|
|
56
|
-
"cli"
|
|
65
|
+
"cli",
|
|
66
|
+
"developer-tools",
|
|
67
|
+
"nodejs",
|
|
68
|
+
"javascript",
|
|
69
|
+
"npm-package",
|
|
70
|
+
"open-source",
|
|
71
|
+
"json-optimizer",
|
|
72
|
+
"json-minifier",
|
|
73
|
+
"json-transform",
|
|
74
|
+
"json-formatter",
|
|
75
|
+
"json-analysis",
|
|
76
|
+
"json-compression",
|
|
77
|
+
"structured-data",
|
|
78
|
+
"structured-format",
|
|
79
|
+
"compact-format",
|
|
80
|
+
"compact-data",
|
|
81
|
+
"lightweight-serialization",
|
|
82
|
+
"serialization",
|
|
83
|
+
"deserialization",
|
|
84
|
+
"data-encoding",
|
|
85
|
+
"data-decoding",
|
|
86
|
+
"token-counter",
|
|
87
|
+
"token-metrics",
|
|
88
|
+
"token-saver",
|
|
89
|
+
"llm-tools",
|
|
90
|
+
"chatgpt-tools",
|
|
91
|
+
"openai-tools",
|
|
92
|
+
"ai-developer-tools",
|
|
93
|
+
"prompt-tools",
|
|
94
|
+
"prompt-engineering",
|
|
95
|
+
"payload-optimizer",
|
|
96
|
+
"text-optimizer",
|
|
97
|
+
"data-optimizer",
|
|
98
|
+
"json-cli",
|
|
99
|
+
"json-webui",
|
|
100
|
+
"llm-friendly",
|
|
101
|
+
"prompt-friendly",
|
|
102
|
+
"structured-compression",
|
|
103
|
+
"encoding-tools",
|
|
104
|
+
"decoder",
|
|
105
|
+
"encoder",
|
|
106
|
+
"tree-shakeable",
|
|
107
|
+
"typescript",
|
|
108
|
+
"ts-library",
|
|
109
|
+
"backend-tools",
|
|
110
|
+
"automation-tools",
|
|
111
|
+
"productivity-tools",
|
|
112
|
+
"developer-productivity",
|
|
113
|
+
"dev-cli",
|
|
114
|
+
"api-tools",
|
|
115
|
+
"file-conversion",
|
|
116
|
+
"file-transform",
|
|
117
|
+
"data-utilities"
|
|
57
118
|
],
|
|
58
119
|
"author": "Bhushan Chaudhari <bhushanschaudhari4@gmail.com>",
|
|
59
120
|
"license": "MIT",
|