jsonx-cli 0.1.0__tar.gz

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.
@@ -0,0 +1,2 @@
1
+ .env
2
+ .vercel
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marcus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: jsonx-cli
3
+ Version: 0.1.0
4
+ Summary: JSON query and transform CLI - simpler than jq
5
+ Project-URL: Homepage, https://github.com/marcusbuildsthings-droid/jsonx
6
+ Project-URL: Repository, https://github.com/marcusbuildsthings-droid/jsonx
7
+ Project-URL: Issues, https://github.com/marcusbuildsthings-droid/jsonx/issues
8
+ Author-email: Marcus <marcus.builds.things@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: automation,cli,jq,json,query,transform
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.8
26
+ Requires-Dist: click>=8.0.0
27
+ Provides-Extra: schema
28
+ Requires-Dist: jsonschema>=4.0.0; extra == 'schema'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # jsonx
32
+
33
+ JSON query and transform CLI — simpler than jq.
34
+
35
+ [![PyPI version](https://badge.fury.io/py/jsonx-cli.svg)](https://pypi.org/project/jsonx-cli/)
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ pip install jsonx-cli
41
+ ```
42
+
43
+ For JSON Schema validation:
44
+ ```bash
45
+ pip install jsonx-cli[schema]
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ```bash
51
+ # Get a nested value
52
+ jsonx get .users[0].name data.json
53
+
54
+ # From stdin
55
+ cat data.json | jsonx get .config.debug
56
+
57
+ # Set a value
58
+ jsonx set .config.debug true data.json
59
+
60
+ # List all keys
61
+ jsonx keys data.json
62
+
63
+ # Pretty print
64
+ jsonx format data.json
65
+ ```
66
+
67
+ ## Path Syntax
68
+
69
+ jsonx uses simple dot notation:
70
+
71
+ | Pattern | Meaning |
72
+ |---------|---------|
73
+ | `.key` | Object property |
74
+ | `.nested.key` | Nested property |
75
+ | `[0]` | Array index |
76
+ | `[-1]` | Last array item |
77
+ | `[*]` | All array items |
78
+ | `[0:3]` | Array slice |
79
+
80
+ Examples:
81
+ ```bash
82
+ jsonx get .name data.json # Get "name" property
83
+ jsonx get .users[0] data.json # First user
84
+ jsonx get .users[-1] data.json # Last user
85
+ jsonx get .users[*].email data.json # All user emails
86
+ jsonx get .items[0:5] data.json # First 5 items
87
+ ```
88
+
89
+ ## Commands
90
+
91
+ ### get - Extract values
92
+
93
+ ```bash
94
+ jsonx get .path [file] # Extract value at path
95
+ jsonx get .path file --raw # Raw output (no quotes)
96
+ jsonx get .path file --json # Force JSON output
97
+ ```
98
+
99
+ ### set - Modify values
100
+
101
+ ```bash
102
+ jsonx set .path value [file] # Set and output
103
+ jsonx set .path value file -i # Modify in place
104
+ jsonx set .path value file -o out.json # Write to file
105
+ ```
106
+
107
+ Value is parsed as JSON:
108
+ ```bash
109
+ jsonx set .debug true data.json # boolean
110
+ jsonx set .count 42 data.json # number
111
+ jsonx set .name '"Alice"' data.json # string (note quotes)
112
+ jsonx set .tags '["a","b"]' data.json # array
113
+ ```
114
+
115
+ ### del - Delete values
116
+
117
+ ```bash
118
+ jsonx del .path [file] # Delete and output
119
+ jsonx del .path file -i # Delete in place
120
+ ```
121
+
122
+ ### keys - List keys
123
+
124
+ ```bash
125
+ jsonx keys [file] # Top-level keys
126
+ jsonx keys file -r # All keys recursively
127
+ ```
128
+
129
+ ### flatten / unflatten - Structure transformation
130
+
131
+ ```bash
132
+ # Flatten nested structure
133
+ jsonx flatten data.json
134
+ # {"users[0].name": "Alice", "config.debug": true}
135
+
136
+ # Unflatten back
137
+ echo '{"user.name": "Alice"}' | jsonx unflatten
138
+ # {"user": {"name": "Alice"}}
139
+ ```
140
+
141
+ ### merge - Combine files
142
+
143
+ ```bash
144
+ jsonx merge base.json override.json # Deep merge
145
+ jsonx merge a.json b.json --shallow # Shallow merge
146
+ ```
147
+
148
+ ### diff - Compare files
149
+
150
+ ```bash
151
+ jsonx diff old.json new.json
152
+ # + config.newKey: "value" (green - added)
153
+ # - config.removed: true (red - removed)
154
+ # ~ config.changed: 1 → 2 (yellow - changed)
155
+ ```
156
+
157
+ ### format / minify - Pretty print
158
+
159
+ ```bash
160
+ jsonx format data.json # Pretty print
161
+ jsonx format data.json -i 4 # 4-space indent
162
+ jsonx minify data.json # Compact
163
+ ```
164
+
165
+ ### validate - JSON Schema
166
+
167
+ ```bash
168
+ jsonx validate data.json schema.json
169
+ # ✓ Valid
170
+ # or
171
+ # ✗ Invalid: 'email' is required
172
+ ```
173
+
174
+ ### type - Show value type
175
+
176
+ ```bash
177
+ echo '[]' | jsonx type # array
178
+ echo '{}' | jsonx type # object
179
+ echo '42' | jsonx type # integer
180
+ ```
181
+
182
+ ### count - Count items
183
+
184
+ ```bash
185
+ jsonx count data.json # Top-level count
186
+ jsonx get .users data.json | jsonx count # Count array items
187
+ ```
188
+
189
+ ### each - Iterate arrays
190
+
191
+ ```bash
192
+ # Output each item as JSON
193
+ jsonx each data.json -p .users
194
+
195
+ # With template
196
+ jsonx each data.json -p .users -t '{.name}: {.email}'
197
+ ```
198
+
199
+ ## Piping
200
+
201
+ jsonx works great in pipelines:
202
+
203
+ ```bash
204
+ # Extract, transform, merge
205
+ cat config.json | jsonx get .database | jsonx set .host '"prod.db"'
206
+
207
+ # Count users
208
+ jsonx get .users data.json | jsonx count
209
+
210
+ # Extract all emails
211
+ jsonx get .users[*].email data.json
212
+
213
+ # Filter and format
214
+ curl api/data | jsonx get .results | jsonx format
215
+ ```
216
+
217
+ ## For AI Agents
218
+
219
+ See [SKILL.md](SKILL.md) for agent-optimized documentation.
220
+
221
+ ## Exit Codes
222
+
223
+ - `0` - Success
224
+ - `1` - Error (invalid JSON, path not found, etc.)
225
+
226
+ ## License
227
+
228
+ MIT
@@ -0,0 +1,198 @@
1
+ # jsonx
2
+
3
+ JSON query and transform CLI — simpler than jq.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/jsonx-cli.svg)](https://pypi.org/project/jsonx-cli/)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install jsonx-cli
11
+ ```
12
+
13
+ For JSON Schema validation:
14
+ ```bash
15
+ pip install jsonx-cli[schema]
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```bash
21
+ # Get a nested value
22
+ jsonx get .users[0].name data.json
23
+
24
+ # From stdin
25
+ cat data.json | jsonx get .config.debug
26
+
27
+ # Set a value
28
+ jsonx set .config.debug true data.json
29
+
30
+ # List all keys
31
+ jsonx keys data.json
32
+
33
+ # Pretty print
34
+ jsonx format data.json
35
+ ```
36
+
37
+ ## Path Syntax
38
+
39
+ jsonx uses simple dot notation:
40
+
41
+ | Pattern | Meaning |
42
+ |---------|---------|
43
+ | `.key` | Object property |
44
+ | `.nested.key` | Nested property |
45
+ | `[0]` | Array index |
46
+ | `[-1]` | Last array item |
47
+ | `[*]` | All array items |
48
+ | `[0:3]` | Array slice |
49
+
50
+ Examples:
51
+ ```bash
52
+ jsonx get .name data.json # Get "name" property
53
+ jsonx get .users[0] data.json # First user
54
+ jsonx get .users[-1] data.json # Last user
55
+ jsonx get .users[*].email data.json # All user emails
56
+ jsonx get .items[0:5] data.json # First 5 items
57
+ ```
58
+
59
+ ## Commands
60
+
61
+ ### get - Extract values
62
+
63
+ ```bash
64
+ jsonx get .path [file] # Extract value at path
65
+ jsonx get .path file --raw # Raw output (no quotes)
66
+ jsonx get .path file --json # Force JSON output
67
+ ```
68
+
69
+ ### set - Modify values
70
+
71
+ ```bash
72
+ jsonx set .path value [file] # Set and output
73
+ jsonx set .path value file -i # Modify in place
74
+ jsonx set .path value file -o out.json # Write to file
75
+ ```
76
+
77
+ Value is parsed as JSON:
78
+ ```bash
79
+ jsonx set .debug true data.json # boolean
80
+ jsonx set .count 42 data.json # number
81
+ jsonx set .name '"Alice"' data.json # string (note quotes)
82
+ jsonx set .tags '["a","b"]' data.json # array
83
+ ```
84
+
85
+ ### del - Delete values
86
+
87
+ ```bash
88
+ jsonx del .path [file] # Delete and output
89
+ jsonx del .path file -i # Delete in place
90
+ ```
91
+
92
+ ### keys - List keys
93
+
94
+ ```bash
95
+ jsonx keys [file] # Top-level keys
96
+ jsonx keys file -r # All keys recursively
97
+ ```
98
+
99
+ ### flatten / unflatten - Structure transformation
100
+
101
+ ```bash
102
+ # Flatten nested structure
103
+ jsonx flatten data.json
104
+ # {"users[0].name": "Alice", "config.debug": true}
105
+
106
+ # Unflatten back
107
+ echo '{"user.name": "Alice"}' | jsonx unflatten
108
+ # {"user": {"name": "Alice"}}
109
+ ```
110
+
111
+ ### merge - Combine files
112
+
113
+ ```bash
114
+ jsonx merge base.json override.json # Deep merge
115
+ jsonx merge a.json b.json --shallow # Shallow merge
116
+ ```
117
+
118
+ ### diff - Compare files
119
+
120
+ ```bash
121
+ jsonx diff old.json new.json
122
+ # + config.newKey: "value" (green - added)
123
+ # - config.removed: true (red - removed)
124
+ # ~ config.changed: 1 → 2 (yellow - changed)
125
+ ```
126
+
127
+ ### format / minify - Pretty print
128
+
129
+ ```bash
130
+ jsonx format data.json # Pretty print
131
+ jsonx format data.json -i 4 # 4-space indent
132
+ jsonx minify data.json # Compact
133
+ ```
134
+
135
+ ### validate - JSON Schema
136
+
137
+ ```bash
138
+ jsonx validate data.json schema.json
139
+ # ✓ Valid
140
+ # or
141
+ # ✗ Invalid: 'email' is required
142
+ ```
143
+
144
+ ### type - Show value type
145
+
146
+ ```bash
147
+ echo '[]' | jsonx type # array
148
+ echo '{}' | jsonx type # object
149
+ echo '42' | jsonx type # integer
150
+ ```
151
+
152
+ ### count - Count items
153
+
154
+ ```bash
155
+ jsonx count data.json # Top-level count
156
+ jsonx get .users data.json | jsonx count # Count array items
157
+ ```
158
+
159
+ ### each - Iterate arrays
160
+
161
+ ```bash
162
+ # Output each item as JSON
163
+ jsonx each data.json -p .users
164
+
165
+ # With template
166
+ jsonx each data.json -p .users -t '{.name}: {.email}'
167
+ ```
168
+
169
+ ## Piping
170
+
171
+ jsonx works great in pipelines:
172
+
173
+ ```bash
174
+ # Extract, transform, merge
175
+ cat config.json | jsonx get .database | jsonx set .host '"prod.db"'
176
+
177
+ # Count users
178
+ jsonx get .users data.json | jsonx count
179
+
180
+ # Extract all emails
181
+ jsonx get .users[*].email data.json
182
+
183
+ # Filter and format
184
+ curl api/data | jsonx get .results | jsonx format
185
+ ```
186
+
187
+ ## For AI Agents
188
+
189
+ See [SKILL.md](SKILL.md) for agent-optimized documentation.
190
+
191
+ ## Exit Codes
192
+
193
+ - `0` - Success
194
+ - `1` - Error (invalid JSON, path not found, etc.)
195
+
196
+ ## License
197
+
198
+ MIT
@@ -0,0 +1,102 @@
1
+ # jsonx - JSON Query & Transform CLI
2
+
3
+ ## Quick Reference
4
+
5
+ | Command | Purpose |
6
+ |---------|---------|
7
+ | `jsonx get .path file` | Extract value |
8
+ | `jsonx set .path value file` | Set value |
9
+ | `jsonx del .path file` | Delete value |
10
+ | `jsonx keys file` | List keys |
11
+ | `jsonx flatten file` | Flatten to dot notation |
12
+ | `jsonx merge a.json b.json` | Merge files |
13
+ | `jsonx diff a.json b.json` | Show differences |
14
+ | `jsonx format file` | Pretty print |
15
+ | `jsonx minify file` | Compact output |
16
+ | `jsonx validate file schema` | Validate schema |
17
+
18
+ ## Path Syntax
19
+
20
+ ```
21
+ .key → object property
22
+ .a.b.c → nested property
23
+ [0] → array index
24
+ [-1] → last item
25
+ [*] → all items (returns array)
26
+ [0:3] → slice (items 0, 1, 2)
27
+ ```
28
+
29
+ ## Common Tasks
30
+
31
+ ### Extract nested value
32
+ ```bash
33
+ jsonx get .config.database.host config.json
34
+ ```
35
+
36
+ ### Get all items from array
37
+ ```bash
38
+ jsonx get .users[*].email data.json
39
+ # ["alice@x.com", "bob@x.com"]
40
+ ```
41
+
42
+ ### Set value in place
43
+ ```bash
44
+ jsonx set .debug true config.json -i
45
+ ```
46
+
47
+ ### Merge configs
48
+ ```bash
49
+ jsonx merge defaults.json overrides.json > merged.json
50
+ ```
51
+
52
+ ### Compare files
53
+ ```bash
54
+ jsonx diff old.json new.json --json
55
+ ```
56
+
57
+ ### Flatten for easier processing
58
+ ```bash
59
+ jsonx flatten nested.json
60
+ # {"users[0].name": "Alice", "config.timeout": 30}
61
+ ```
62
+
63
+ ### Iterate array with template
64
+ ```bash
65
+ jsonx each data.json -p .users -t '{.id}: {.name}'
66
+ # 1: Alice
67
+ # 2: Bob
68
+ ```
69
+
70
+ ## JSON Output
71
+
72
+ Most commands output JSON by default. For scalar values, use `--raw` to strip quotes:
73
+
74
+ ```bash
75
+ jsonx get .name data.json # "Alice"
76
+ jsonx get .name data.json --raw # Alice
77
+ ```
78
+
79
+ ## Stdin Support
80
+
81
+ All commands accept stdin:
82
+ ```bash
83
+ curl api/endpoint | jsonx get .results
84
+ cat data.json | jsonx set .updated true
85
+ ```
86
+
87
+ ## Error Handling
88
+
89
+ - Missing key: exits 1, prints "Key not found: keyname"
90
+ - Invalid JSON: exits 1, prints "Invalid JSON: ..."
91
+ - Type mismatch: exits 1, prints "Cannot index/get key from type"
92
+
93
+ Always check exit code in scripts.
94
+
95
+ ## Schema Validation
96
+
97
+ Requires `pip install jsonx-cli[schema]`:
98
+ ```bash
99
+ jsonx validate data.json schema.json
100
+ # ✓ Valid (exit 0)
101
+ # ✗ Invalid: message (exit 1)
102
+ ```
jsonx_cli-0.1.0/a.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"Alice","age":30}
jsonx_cli-0.1.0/b.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"Alice","age":31,"email":"a@x.com"}
@@ -0,0 +1,3 @@
1
+ """jsonx - JSON query and transform CLI"""
2
+
3
+ __version__ = "0.1.0"