-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest5.rb
306 lines (286 loc) · 9.22 KB
/
test5.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
require 'json'
require 'rubygems'
# json = '[
# {
# "text": "AutoComplete",
# "name": "autocomplete",
# "api": "web/autocomplete",
# "documentation": {
# "aspnet-mvc": "helpers/autocomplete/overview"
# },
# "forum": {
# "aspnet-mvc": "aspnet-mvc/autocomplete"
# },
# "codelibrary": {
# "aspnet-mvc": "aspnet-mvc/autocomplete"
# },
# "spriteCssClass": "autoCompleteIcon",
# "items": [
# {
# "text": "Basic usage",
# "url": "autocomplete/index",
# "title": {
# "aspnet-mvc": "Demo and source code for Telerik $FRAMEWORK AutoComplete"
# },
# "meta": {
# "aspnet-mvc": "See how the Telerik $FRAMEWORK AutoComplete control works and view the demo source code."
# }
# },
# {
# "text": "Server filtering",
# "url": "autocomplete/serverfiltering",
# "title": {
# "aspnet-mvc": "Server filtering in $FRAMEWORK AutoComplete control"
# },
# "meta": {
# "aspnet-mvc": "This demo of $FRAMEWORK AutoComplete control shows how autocomplete suggestions are given upon typing and the data is loaded from OData remote data source."
# }
# },
# {
# "text": "Virtualization",
# "url": "autocomplete/virtualization",
# "title": {
# "aspnet-mvc": "Virtualization in $FRAMEWORK AutoComplete control"
# },
# "meta": {
# "aspnet-mvc": "This demo of ASP.NET MVC AutoComplete control shows how load large amount of data in the autocomplete widget"
# }
# },
# {
# "text": "Grouping",
# "url": "autocomplete/grouping",
# "title": {
# "aspnet-mvc": "Grouping in $FRAMEWORK AutoComplete control"
# },
# "meta": {
# "aspnet-mvc": "This demo of ASP.NET MVC AutoComplete control shows how load grouped data in the autocomplete widget"
# }
# },
# {
# "text": "Client filtering",
# "url": "autocomplete/clientfiltering",
# "packages": [ "!online", "!jsp", "!php" ]
# },
# {
# "text": "Customizing templates",
# "url": "autocomplete/template",
# "title": {
# "aspnet-mvc": "Templates customization in $FRAMEWORK AutoComplete"
# },
# "meta": {
# "aspnet-mvc": "With this $FRAMEWORK AutoComplete demo, you can learn how to customize the template of the control."
# }
# },
# {
# "text": "Custom data source",
# "url": "autocomplete/custom-datasource",
# "packages": [ "!online", "!jsp", "!php" ]
# },
# {
# "text": "Events",
# "url": "autocomplete/events",
# "title": {
# "aspnet-mvc": "Events in MVC AutoComplete component | UI for $FRAMEWORK demos"
# },
# "meta": {
# "aspnet-mvc": "Take a look at this $FRAMEWORK AutoComplete example to find out how events are triggered in the AutoComplete control."
# }
# },
# {
# "text": "API",
# "url": "autocomplete/api",
# "title": {
# "aspnet-mvc": "Example of $FRAMEWORK AutoComplete component API"
# },
# "meta": {
# "aspnet-mvc": "The API Functions of $FRAMEWORK AutoComplete give you the option to set a specific value, attribute a value for the string, starting with a symbol or a digit."
# }
# },
# {
# "text": "RTL support",
# "url": "autocomplete/right-to-left-support",
# "title": {
# "aspnet-mvc": "Right-to-left support in $FRAMEWORK AutoComplete component"
# },
# "meta": {
# "aspnet-mvc": "We will demonstrate how the right-to-left typing feature is implemented in the text input field of the $FRAMEWORK AutoComplete control."
# }
# },
# {
# "text": "Keyboard navigation",
# "url": "autocomplete/keyboard-navigation",
# "title": {
# "aspnet-mvc": "Keyboard navigation in $FRAMEWORK AutoComplete control"
# },
# "meta": {
# "aspnet-mvc": "Look at this $FRAMEWORK demo which illustrates how the keyboard navigation feature is supported in Telerik AutoComplete."
# }
# }
# ],
# "category": "Editors"
# },
# {
# "category": "PDF",
# "text": "PDFViewer",
# "name": "pdfviewer",
# "updated": "true",
# "pro": true,
# "spriteCssClass": "pdfviewerIcon",
# "items": [
# {
# "text": "Basic usage",
# "url": "pdfviewer/index",
# "title": {
# "aspnet-mvc": "Basic usage of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use the PDFViewer."
# }
# },
# {
# "text": "DPL Processing",
# "url": "pdfviewer/dpl-processing",
# "packages": [ "!online", "!jsp", "!php" ],
# "title": {
# "aspnet-mvc": "DPL Processing in the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use DPL Processing in the PDFViewer."
# },
# "description": {
# "aspnet-mvc": "<p>DPL Processing is BETA version and has the following limitations: </p> <ul> <li>Clipping elements and Gradients are currently not supported.</li> <li>SVG or encoded images in other formats might not render correctly.</li> </ul>"
# }
# },
# {
# "text": "Events",
# "url": "pdfviewer/events",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "Events of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to handle the PDFViewer events."
# }
# },
# {
# "text": "API",
# "url": "pdfviewer/api",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "API of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use the PDFViewer API."
# }
# },
# {
# "text": "Keyboard Navigation",
# "url": "pdfviewer/keyboard-navigation",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "Keyboard Navigation of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to navigate the PDFViewer with the keyboard."
# }
# }
# ]
# },
# {
# "category": "PDF",
# "text": "PDFViewer",
# "name": "pdfviewer",
# "updated": "true",
# "pro": true,
# "spriteCssClass": "pdfviewerIcon",
# "items": [
# {
# "text": "Basic usage",
# "url": "pdfviewer/index",
# "title": {
# "aspnet-mvc": "Basic usage of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use the PDFViewer."
# }
# },
# {
# "text": "DPL Processing",
# "url": "pdfviewer/dpl-processing",
# "packages": [ "!online", "!jsp", "!php" ],
# "title": {
# "aspnet-mvc": "DPL Processing in the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use DPL Processing in the PDFViewer."
# },
# "description": {
# "aspnet-mvc": "<p>DPL Processing is BETA version and has the following limitations: </p> <ul> <li>Clipping elements and Gradients are currently not supported.</li> <li>SVG or encoded images in other formats might not render correctly.</li> </ul>"
# }
# },
# {
# "text": "Events",
# "url": "pdfviewer/events",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "Events of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to handle the PDFViewer events."
# }
# },
# {
# "text": "API",
# "url": "pdfviewer/api",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "API of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to use the PDFViewer API."
# }
# },
# {
# "text": "Keyboard Navigation",
# "url": "pdfviewer/keyboard-navigation",
# "packages": [
# "!jsp",
# "!php"
# ],
# "title": {
# "aspnet-mvc": "Keyboard Navigation of the PDFViewer"
# },
# "meta": {
# "aspnet-mvc": "This demo shows how to navigate the PDFViewer with the keyboard."
# }
# }
# ]
# }
# ]'
ORIGINAL_JSON = 'nav.json'
# json = JSON.parse(File.read(ORIGINAL_JSON))
# parsed_data = JSON.parse(json)
NEW_JSON = 'navtest.json'
jsonHash = File.read(ORIGINAL_JSON)
parsed_data = JSON.parse(jsonHash)
result = parsed_data.delete_if do |data|
# data['batters']['batter'].detect { |batter| batter['type'] == 'DeleteMe' }
data['items'].detect { |items| items['text'] == 'Drill-Down Grid Report' }
end
# puts(JSON.pretty_generate(result))
File.write(NEW_JSON, JSON.pretty_generate(result))