Commit 695ea59 Noboru Saito
committed
1 parent 965747f commit 695ea59 Copy full SHA for 695ea59
File tree 1 file changed +55
-2
lines changed
1 file changed +55
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
[ ![ Build Status] ( https://travis-ci.org/noborus/trdsql.svg?branch=master )] ( https://travis-ci.org/noborus/trdsql )
4
4
5
- A tool that can execute SQL queries on CSV and [ LTSV] ( http://ltsv.org/ ) .
5
+ A tool that can execute SQL queries on CSV, [ LTSV] ( http://ltsv.org/ ) and JSON .
6
6
7
7
It is a tool like [ q] ( https://github.com/harelba/q ) , [ textql] ( https://github.com/dinedal/textql ) and others.
8
8
@@ -161,7 +161,60 @@ name:Apple price:100 id:3
161
161
162
162
** Note:** LTSV does not keep the output order of the columns
163
163
164
- ### JSON (output only)
164
+ ### JSON
165
+
166
+ For JSON files, specify option -ijson.
167
+
168
+ sample.json
169
+ ``` JSON
170
+ [
171
+ {
172
+ "id" : " 1" ,
173
+ "name" : " Orange" ,
174
+ "price" : " 50"
175
+ },
176
+ {
177
+ "id" : " 2" ,
178
+ "name" : " Melon" ,
179
+ "price" : " 500"
180
+ },
181
+ {
182
+ "id" : " 3" ,
183
+ "name" : " Apple" ,
184
+ "price" : " 100"
185
+ }
186
+ ]
187
+ ```
188
+
189
+ ``` sh
190
+ $ trdsql -iltsv " SELECT * FROM sample.json"
191
+ ```
192
+
193
+ ``` CSV
194
+ 1,Orange,50
195
+ 2,Melon,500
196
+ 3,Apple,100
197
+ ```
198
+ Another json format. One record is JSON.
199
+
200
+ sample2.json
201
+ ``` JSON
202
+ {
203
+ "id" : " 1" ,
204
+ "name" : " Orange" ,
205
+ "price" : " 50"
206
+ }
207
+ {
208
+ "id" : " 2" ,
209
+ "name" : " Melon" ,
210
+ "price" : " 500"
211
+ }
212
+ {
213
+ "id" : " 3" ,
214
+ "name" : " Apple" ,
215
+ "price" : " 100"
216
+ }
217
+ ```
165
218
166
219
Output JSON with option -ojson.
167
220
You can’t perform that action at this time.
0 commit comments