@rfanth/tjson 0.3.1 → 0.3.2
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 +22 -5
- package/package.json +1 -1
- package/tjson_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Add to your `Cargo.toml`:
|
|
|
12
12
|
|
|
13
13
|
```toml
|
|
14
14
|
[dependencies]
|
|
15
|
-
tjson = "0.
|
|
15
|
+
tjson = "0.3"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Install the CLI:
|
|
@@ -86,17 +86,34 @@ tjson --canonical -i data.json
|
|
|
86
86
|
|
|
87
87
|
## WASM / JavaScript
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Install:
|
|
90
90
|
|
|
91
91
|
```sh
|
|
92
|
-
|
|
92
|
+
npm install @rfanth/tjson
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
Usage:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import { parse, stringify } from '@rfanth/tjson';
|
|
99
|
+
|
|
100
|
+
// Render JSON as TJSON
|
|
101
|
+
const tjson = stringify('{"name":"Alice","scores":[1,2,3]}');
|
|
102
|
+
|
|
103
|
+
// With options (camelCase for WASM/JS only)
|
|
104
|
+
const canonical = stringify('{"name":"Alice"}', { canonical: true });
|
|
105
|
+
const narrow = stringify('{"name":"Alice"}', { wrapWidth: 40, stringArrayStyle: 'preferSpaces' });
|
|
106
|
+
|
|
107
|
+
// Parse TJSON back to a JSON string
|
|
108
|
+
const json = parse(' name: Alice');
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
95
112
|
## Resources
|
|
96
113
|
|
|
97
114
|
- Website and online demo: [textjson.com](https://textjson.com)
|
|
98
|
-
- Specification:
|
|
99
|
-
- Test suite:
|
|
115
|
+
- Specification: [tjson-specification.md](https://github.com/rfanth/tjson-spec/blob/master/tjson-specification.md)
|
|
116
|
+
- Test suite: [tjson-tests](https://github.com/rfanth/tjson-tests)
|
|
100
117
|
|
|
101
118
|
## License
|
|
102
119
|
|
package/package.json
CHANGED
package/tjson_bg.wasm
CHANGED
|
Binary file
|