Ondřej Hruška 7 months ago
commit
1be96a81a3
Signed by: Ondřej Hruška <ondra@ondrovo.com> GPG key ID: 2C5FD5035250423D
10 changed files with 2394 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 11 0
      .idea/dashie-json-cleaner.iml
  3. 8 0
      .idea/modules.xml
  4. 6 0
      .idea/vcs.xml
  5. 117 0
      .idea/workspace.xml
  6. 85 0
      Cargo.lock
  7. 12 0
      Cargo.toml
  8. 643 0
      cleaned.json
  9. 1491 0
      src/categories.json
  10. 20 0
      src/main.rs

+ 1 - 0
.gitignore View File

@@ -0,0 +1 @@
1
+/target

+ 11 - 0
.idea/dashie-json-cleaner.iml View File

@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="CPP_MODULE" version="4">
3
+  <component name="NewModuleRootManager">
4
+    <content url="file://$MODULE_DIR$">
5
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
6
+      <excludeFolder url="file://$MODULE_DIR$/target" />
7
+    </content>
8
+    <orderEntry type="inheritedJdk" />
9
+    <orderEntry type="sourceFolder" forTests="false" />
10
+  </component>
11
+</module>

+ 8 - 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/dashie-json-cleaner.iml" filepath="$PROJECT_DIR$/.idea/dashie-json-cleaner.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6 - 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 117 - 0
.idea/workspace.xml View File

@@ -0,0 +1,117 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
4
+    <generated />
5
+  </component>
6
+  <component name="CMakeSettings">
7
+    <configurations>
8
+      <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
9
+    </configurations>
10
+  </component>
11
+  <component name="CargoProjects">
12
+    <cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
13
+  </component>
14
+  <component name="ChangeListManager">
15
+    <list default="true" id="347ac394-0ad5-4cf8-9761-e820aa06b74f" name="Default Changelist" comment="" />
16
+    <option name="SHOW_DIALOG" value="false" />
17
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
18
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
19
+    <option name="LAST_RESOLUTION" value="IGNORE" />
20
+  </component>
21
+  <component name="ClangdSettings">
22
+    <option name="formatViaClangd" value="false" />
23
+  </component>
24
+  <component name="FileColors">
25
+    <fileColor scope="Non-Project Files (Material Default)" color="2E3C43" />
26
+    <fileColor scope="Non-Project Files (Material Darker)" color="323232" />
27
+    <fileColor scope="Non-Project Files (Material Lighter)" color="eae8e8" />
28
+    <fileColor scope="Non-Project Files (Material Palenight)" color="2f2e43" />
29
+  </component>
30
+  <component name="Git.Settings">
31
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
32
+  </component>
33
+  <component name="MacroExpansionManager">
34
+    <option name="directoryName" value="7efyyuuv" />
35
+  </component>
36
+  <component name="ProjectId" id="1kCnbhHOO1kdzdJlamS78WTnV0i" />
37
+  <component name="ProjectViewState">
38
+    <option name="hideEmptyMiddlePackages" value="true" />
39
+    <option name="showLibraryContents" value="true" />
40
+  </component>
41
+  <component name="PropertiesComponent">
42
+    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
43
+    <property name="WebServerToolWindowFactoryState" value="false" />
44
+    <property name="cf.first.check.clang-format" value="false" />
45
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
46
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
47
+    <property name="nodejs_package_manager_path" value="npm" />
48
+    <property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
49
+    <property name="settings.editor.selected.configurable" value="editor.preferences.gutterIcons" />
50
+  </component>
51
+  <component name="RecentsManager">
52
+    <key name="MoveFile.RECENT_KEYS">
53
+      <recent name="$PROJECT_DIR$/src" />
54
+    </key>
55
+  </component>
56
+  <component name="RunManager">
57
+    <configuration name="Run" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
58
+      <option name="channel" value="DEFAULT" />
59
+      <option name="command" value="run --package dashie-json-cleaner --bin dashie-json-cleaner" />
60
+      <option name="allFeatures" value="false" />
61
+      <option name="emulateTerminal" value="false" />
62
+      <option name="backtrace" value="SHORT" />
63
+      <option name="workingDirectory" value="file://$PROJECT_DIR$" />
64
+      <envs />
65
+      <method v="2">
66
+        <option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
67
+      </method>
68
+    </configuration>
69
+    <configuration default="true" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
70
+      <option name="channel" value="DEFAULT" />
71
+      <option name="command" value="run" />
72
+      <option name="allFeatures" value="false" />
73
+      <option name="emulateTerminal" value="false" />
74
+      <option name="backtrace" value="SHORT" />
75
+      <envs />
76
+      <method v="2">
77
+        <option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
78
+      </method>
79
+    </configuration>
80
+  </component>
81
+  <component name="RustProjectSettings">
82
+    <option name="toolchainHomeDirectory" value="/usr/bin" />
83
+  </component>
84
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
85
+  <component name="TaskManager">
86
+    <task active="true" id="Default" summary="Default task">
87
+      <changelist id="347ac394-0ad5-4cf8-9761-e820aa06b74f" name="Default Changelist" comment="" />
88
+      <created>1605213513593</created>
89
+      <option name="number" value="Default" />
90
+      <option name="presentableId" value="Default" />
91
+      <updated>1605213513593</updated>
92
+      <workItem from="1605213514991" duration="506000" />
93
+    </task>
94
+    <servers />
95
+  </component>
96
+  <component name="TypeScriptGeneratedFilesManager">
97
+    <option name="version" value="3" />
98
+  </component>
99
+  <component name="WindowStateProjectService">
100
+    <state width="1870" height="476" key="GridCell.Tab.0.bottom" timestamp="1605213924711">
101
+      <screen x="0" y="32" width="1920" height="1168" />
102
+    </state>
103
+    <state width="1870" height="476" key="GridCell.Tab.0.bottom/0.32.1920.1168/1920.0.1600.1200@0.32.1920.1168" timestamp="1605213924711" />
104
+    <state width="1870" height="476" key="GridCell.Tab.0.center" timestamp="1605213924711">
105
+      <screen x="0" y="32" width="1920" height="1168" />
106
+    </state>
107
+    <state width="1870" height="476" key="GridCell.Tab.0.center/0.32.1920.1168/1920.0.1600.1200@0.32.1920.1168" timestamp="1605213924711" />
108
+    <state width="1870" height="476" key="GridCell.Tab.0.left" timestamp="1605213924711">
109
+      <screen x="0" y="32" width="1920" height="1168" />
110
+    </state>
111
+    <state width="1870" height="476" key="GridCell.Tab.0.left/0.32.1920.1168/1920.0.1600.1200@0.32.1920.1168" timestamp="1605213924711" />
112
+    <state width="1870" height="476" key="GridCell.Tab.0.right" timestamp="1605213924711">
113
+      <screen x="0" y="32" width="1920" height="1168" />
114
+    </state>
115
+    <state width="1870" height="476" key="GridCell.Tab.0.right/0.32.1920.1168/1920.0.1600.1200@0.32.1920.1168" timestamp="1605213924711" />
116
+  </component>
117
+</project>

+ 85 - 0
Cargo.lock View File

@@ -0,0 +1,85 @@
1
+# This file is automatically @generated by Cargo.
2
+# It is not intended for manual editing.
3
+[[package]]
4
+name = "dashie-json-cleaner"
5
+version = "0.1.0"
6
+dependencies = [
7
+ "serde",
8
+ "serde_derive",
9
+ "serde_json",
10
+]
11
+
12
+[[package]]
13
+name = "itoa"
14
+version = "0.4.6"
15
+source = "registry+https://github.com/rust-lang/crates.io-index"
16
+checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
17
+
18
+[[package]]
19
+name = "proc-macro2"
20
+version = "1.0.24"
21
+source = "registry+https://github.com/rust-lang/crates.io-index"
22
+checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
23
+dependencies = [
24
+ "unicode-xid",
25
+]
26
+
27
+[[package]]
28
+name = "quote"
29
+version = "1.0.7"
30
+source = "registry+https://github.com/rust-lang/crates.io-index"
31
+checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
32
+dependencies = [
33
+ "proc-macro2",
34
+]
35
+
36
+[[package]]
37
+name = "ryu"
38
+version = "1.0.5"
39
+source = "registry+https://github.com/rust-lang/crates.io-index"
40
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
41
+
42
+[[package]]
43
+name = "serde"
44
+version = "1.0.117"
45
+source = "registry+https://github.com/rust-lang/crates.io-index"
46
+checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
47
+
48
+[[package]]
49
+name = "serde_derive"
50
+version = "1.0.117"
51
+source = "registry+https://github.com/rust-lang/crates.io-index"
52
+checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
53
+dependencies = [
54
+ "proc-macro2",
55
+ "quote",
56
+ "syn",
57
+]
58
+
59
+[[package]]
60
+name = "serde_json"
61
+version = "1.0.59"
62
+source = "registry+https://github.com/rust-lang/crates.io-index"
63
+checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
64
+dependencies = [
65
+ "itoa",
66
+ "ryu",
67
+ "serde",
68
+]
69
+
70
+[[package]]
71
+name = "syn"
72
+version = "1.0.48"
73
+source = "registry+https://github.com/rust-lang/crates.io-index"
74
+checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
75
+dependencies = [
76
+ "proc-macro2",
77
+ "quote",
78
+ "unicode-xid",
79
+]
80
+
81
+[[package]]
82
+name = "unicode-xid"
83
+version = "0.2.1"
84
+source = "registry+https://github.com/rust-lang/crates.io-index"
85
+checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"

+ 12 - 0
Cargo.toml View File

@@ -0,0 +1,12 @@
1
+[package]
2
+name = "dashie-json-cleaner"
3
+version = "0.1.0"
4
+authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
5
+edition = "2018"
6
+
7
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+[dependencies]
10
+serde = "1.0.117"
11
+serde_json = "1.0.59"
12
+serde_derive = "1.0.117"

+ 643 - 0
cleaned.json View File

@@ -0,0 +1,643 @@
1
+{
2
+  "name": "Root Category",
3
+  "children": [
4
+    {
5
+      "name": "# Free Space",
6
+      "description": ""
7
+    },
8
+    {
9
+      "name": "1 Active Components",
10
+      "description": "",
11
+      "children": [
12
+        {
13
+          "name": "1 Semiconductors",
14
+          "description": "",
15
+          "children": [
16
+            {
17
+              "name": "1 Transistors",
18
+              "description": "",
19
+              "children": [
20
+                {
21
+                  "name": "MOSFET",
22
+                  "description": ""
23
+                },
24
+                {
25
+                  "name": "NPN",
26
+                  "description": ""
27
+                },
28
+                {
29
+                  "name": "PNP",
30
+                  "description": ""
31
+                }
32
+              ]
33
+            },
34
+            {
35
+              "name": "2 Integrated Circuits",
36
+              "description": "",
37
+              "children": [
38
+                {
39
+                  "name": "1 7400 series",
40
+                  "description": "https://en.wikipedia.org/wiki/List_of_7400-series_integrated_circuits",
41
+                  "children": [
42
+                    {
43
+                      "name": "1 Counters",
44
+                      "description": ""
45
+                    },
46
+                    {
47
+                      "name": "Z Others",
48
+                      "description": ""
49
+                    }
50
+                  ]
51
+                },
52
+                {
53
+                  "name": "2 ADC, DAC",
54
+                  "description": ""
55
+                },
56
+                {
57
+                  "name": "3 Microcontrollers",
58
+                  "description": ""
59
+                },
60
+                {
61
+                  "name": "4 OpAmps",
62
+                  "description": ""
63
+                },
64
+                {
65
+                  "name": "5 Timers",
66
+                  "description": ""
67
+                },
68
+                {
69
+                  "name": "6 EPROM",
70
+                  "description": ""
71
+                },
72
+                {
73
+                  "name": "7 EEPROM",
74
+                  "description": ""
75
+                },
76
+                {
77
+                  "name": "8 Comparators",
78
+                  "description": ""
79
+                },
80
+                {
81
+                  "name": "9 MOSFET Drivers",
82
+                  "description": ""
83
+                },
84
+                {
85
+                  "name": "A Voltage Regulators / Controllers",
86
+                  "description": ""
87
+                },
88
+                {
89
+                  "name": "Z Others",
90
+                  "description": ""
91
+                },
92
+                {
93
+                  "name": "B FPGA",
94
+                  "description": ""
95
+                },
96
+                {
97
+                  "name": "C CPLD",
98
+                  "description": ""
99
+                },
100
+                {
101
+                  "name": "D PAL",
102
+                  "description": ""
103
+                },
104
+                {
105
+                  "name": "E GAL",
106
+                  "description": ""
107
+                },
108
+                {
109
+                  "name": "F RAM",
110
+                  "description": "",
111
+                  "children": [
112
+                    {
113
+                      "name": "SRAM",
114
+                      "description": ""
115
+                    },
116
+                    {
117
+                      "name": "DRAM",
118
+                      "description": ""
119
+                    }
120
+                  ]
121
+                },
122
+                {
123
+                  "name": "G Buffer/Line driver",
124
+                  "description": ""
125
+                },
126
+                {
127
+                  "name": "H UART / Serial",
128
+                  "description": ""
129
+                },
130
+                {
131
+                  "name": "0 4000 series",
132
+                  "description": "https://en.wikipedia.org/wiki/List_of_4000-series_integrated_circuits",
133
+                  "children": [
134
+                    {
135
+                      "name": "Analog Switches",
136
+                      "description": ""
137
+                    }
138
+                  ]
139
+                }
140
+              ]
141
+            },
142
+            {
143
+              "name": "3 Diodes",
144
+              "description": "",
145
+              "children": [
146
+                {
147
+                  "name": "1 Universal",
148
+                  "description": ""
149
+                },
150
+                {
151
+                  "name": "2 Schottky",
152
+                  "description": ""
153
+                },
154
+                {
155
+                  "name": "3 Z Diodes",
156
+                  "description": ""
157
+                },
158
+                {
159
+                  "name": "4 Rectifiers and Rectifier Diodes",
160
+                  "description": ""
161
+                }
162
+              ]
163
+            },
164
+            {
165
+              "name": "4 Triacs",
166
+              "description": ""
167
+            },
168
+            {
169
+              "name": "5 Voltage References",
170
+              "description": ""
171
+            },
172
+            {
173
+              "name": "Thyristor",
174
+              "description": "",
175
+              "children": [
176
+                {
177
+                  "name": "1 TRIACs",
178
+                  "description": ""
179
+                },
180
+                {
181
+                  "name": "2 SCR",
182
+                  "description": ""
183
+                }
184
+              ]
185
+            }
186
+          ]
187
+        },
188
+        {
189
+          "name": "2 Optoelectronics",
190
+          "description": "",
191
+          "children": [
192
+            {
193
+              "name": "1 LED",
194
+              "description": "",
195
+              "children": [
196
+                {
197
+                  "name": "Module",
198
+                  "description": ""
199
+                },
200
+                {
201
+                  "name": "SMD",
202
+                  "description": ""
203
+                },
204
+                {
205
+                  "name": "Standard",
206
+                  "description": ""
207
+                }
208
+              ]
209
+            },
210
+            {
211
+              "name": "2 LCD Displays",
212
+              "description": "",
213
+              "children": [
214
+                {
215
+                  "name": "1 Text",
216
+                  "description": ""
217
+                },
218
+                {
219
+                  "name": "2 Graphics",
220
+                  "description": ""
221
+                }
222
+              ]
223
+            },
224
+            {
225
+              "name": "3 Octocouplers",
226
+              "description": ""
227
+            },
228
+            {
229
+              "name": "4 Others",
230
+              "description": ""
231
+            },
232
+            {
233
+              "name": "5 Optical Switches",
234
+              "description": ""
235
+            }
236
+          ]
237
+        },
238
+        {
239
+          "name": "3 Others",
240
+          "description": "",
241
+          "children": [
242
+            {
243
+              "name": "Inverter",
244
+              "description": ""
245
+            }
246
+          ]
247
+        }
248
+      ]
249
+    },
250
+    {
251
+      "name": "2 Passive Components",
252
+      "description": "",
253
+      "children": [
254
+        {
255
+          "name": "1 Resistors",
256
+          "description": "",
257
+          "children": [
258
+            {
259
+              "name": "1 Metal Film 1%",
260
+              "description": ""
261
+            },
262
+            {
263
+              "name": "2 Carbon Film 5%",
264
+              "description": ""
265
+            },
266
+            {
267
+              "name": "3 Networks",
268
+              "description": ""
269
+            },
270
+            {
271
+              "name": "4 Power Resistors",
272
+              "description": ""
273
+            },
274
+            {
275
+              "name": "PTC",
276
+              "description": ""
277
+            }
278
+          ]
279
+        },
280
+        {
281
+          "name": "2 Capacitors",
282
+          "description": "",
283
+          "children": [
284
+            {
285
+              "name": "1 Ceramic",
286
+              "description": ""
287
+            },
288
+            {
289
+              "name": "2 Electrolythic",
290
+              "description": ""
291
+            },
292
+            {
293
+              "name": "3 Film",
294
+              "description": ""
295
+            },
296
+            {
297
+              "name": "Styroflex",
298
+              "description": ""
299
+            },
300
+            {
301
+              "name": "Tantal",
302
+              "description": ""
303
+            }
304
+          ]
305
+        },
306
+        {
307
+          "name": "3 Crystals, OSC, Filt",
308
+          "description": "",
309
+          "children": [
310
+            {
311
+              "name": "1 Crystals",
312
+              "description": ""
313
+            },
314
+            {
315
+              "name": "2 Oscillators",
316
+              "description": ""
317
+            },
318
+            {
319
+              "name": "3 Filters",
320
+              "description": ""
321
+            }
322
+          ]
323
+        },
324
+        {
325
+          "name": "4 Potentiometers / Padders",
326
+          "description": "",
327
+          "children": [
328
+            {
329
+              "name": "1 Potentiometers",
330
+              "description": ""
331
+            },
332
+            {
333
+              "name": "2 Trimmer",
334
+              "description": "",
335
+              "children": [
336
+                {
337
+                  "name": "1 10/25 Tirms precision",
338
+                  "description": ""
339
+                },
340
+                {
341
+                  "name": "2 Cermet",
342
+                  "description": ""
343
+                },
344
+                {
345
+                  "name": "3 Precision",
346
+                  "description": ""
347
+                }
348
+              ]
349
+            },
350
+            {
351
+              "name": "3 Slide Potentiometer",
352
+              "description": ""
353
+            },
354
+            {
355
+              "name": "4 Encoders",
356
+              "description": ""
357
+            }
358
+          ]
359
+        },
360
+        {
361
+          "name": "8 Photoresistors / LDRs",
362
+          "description": ""
363
+        },
364
+        {
365
+          "name": "9 Varistor",
366
+          "description": ""
367
+        }
368
+      ]
369
+    },
370
+    {
371
+      "name": "3 Electromechanical Parts",
372
+      "description": "",
373
+      "children": [
374
+        {
375
+          "name": "1 Connectors",
376
+          "description": "",
377
+          "children": [
378
+            {
379
+              "name": "1 IC Sockets",
380
+              "description": ""
381
+            },
382
+            {
383
+              "name": "2 PCB Connectors",
384
+              "description": "",
385
+              "children": [
386
+                {
387
+                  "name": "1 Rectangular",
388
+                  "description": "",
389
+                  "children": [
390
+                    {
391
+                      "name": "1 Wire-to-Board",
392
+                      "description": ""
393
+                    },
394
+                    {
395
+                      "name": "2 USB",
396
+                      "description": ""
397
+                    },
398
+                    {
399
+                      "name": "3 D-Sub",
400
+                      "description": ""
401
+                    },
402
+                    {
403
+                      "name": "4 IDC Connectors and Box Headers",
404
+                      "description": ""
405
+                    },
406
+                    {
407
+                      "name": "5 Terminal Blocks",
408
+                      "description": ""
409
+                    },
410
+                    {
411
+                      "name": "6 Board to Board",
412
+                      "description": ""
413
+                    },
414
+                    {
415
+                      "name": "7 Pin Headers",
416
+                      "description": ""
417
+                    }
418
+                  ]
419
+                },
420
+                {
421
+                  "name": "2 Round",
422
+                  "description": ""
423
+                },
424
+                {
425
+                  "name": "3 Audio",
426
+                  "description": ""
427
+                },
428
+                {
429
+                  "name": "4 Others",
430
+                  "description": ""
431
+                },
432
+                {
433
+                  "name": "5 WAGO",
434
+                  "description": ""
435
+                },
436
+                {
437
+                  "name": "6 Faston",
438
+                  "description": ""
439
+                },
440
+                {
441
+                  "name": "7 HF",
442
+                  "description": ""
443
+                },
444
+                {
445
+                  "name": "8 DC Power Jacks",
446
+                  "description": ""
447
+                },
448
+                {
449
+                  "name": "9 Lab Connectors",
450
+                  "description": ""
451
+                }
452
+              ]
453
+            }
454
+          ]
455
+        },
456
+        {
457
+          "name": "2 Switches and Buttons",
458
+          "description": "",
459
+          "children": [
460
+            {
461
+              "name": "1 Switches",
462
+              "description": ""
463
+            },
464
+            {
465
+              "name": "2 Push Button",
466
+              "description": ""
467
+            },
468
+            {
469
+              "name": "3 Code Switches",
470
+              "description": ""
471
+            },
472
+            {
473
+              "name": "4 DIP Switches",
474
+              "description": ""
475
+            },
476
+            {
477
+              "name": "5 Accessories",
478
+              "description": ""
479
+            }
480
+          ]
481
+        },
482
+        {
483
+          "name": "3 Relais",
484
+          "description": ""
485
+        },
486
+        {
487
+          "name": "4 Fuses",
488
+          "description": "",
489
+          "children": [
490
+            {
491
+              "name": "1 5*20",
492
+              "description": ""
493
+            },
494
+            {
495
+              "name": "2 6,3*32",
496
+              "description": ""
497
+            },
498
+            {
499
+              "name": "3 Blade Fuses",
500
+              "description": ""
501
+            }
502
+          ]
503
+        },
504
+        {
505
+          "name": "5 Battery Holders",
506
+          "description": ""
507
+        },
508
+        {
509
+          "name": "6 Transformers",
510
+          "description": ""
511
+        },
512
+        {
513
+          "name": "7 Motors",
514
+          "description": "",
515
+          "children": [
516
+            {
517
+              "name": "1 DC",
518
+              "description": ""
519
+            },
520
+            {
521
+              "name": "2 Stepper",
522
+              "description": ""
523
+            },
524
+            {
525
+              "name": "3 Servo",
526
+              "description": ""
527
+            },
528
+            {
529
+              "name": "4 Brushless",
530
+              "description": ""
531
+            }
532
+          ]
533
+        },
534
+        {
535
+          "name": "8 Selenoids",
536
+          "description": ""
537
+        }
538
+      ]
539
+    },
540
+    {
541
+      "name": "4 Mechanical Parts",
542
+      "description": "",
543
+      "children": [
544
+        {
545
+          "name": "1 Mica Washers",
546
+          "description": ""
547
+        },
548
+        {
549
+          "name": "2 Cooling",
550
+          "description": ""
551
+        },
552
+        {
553
+          "name": "3 Screws",
554
+          "description": "",
555
+          "children": [
556
+            {
557
+              "name": "1 Auto",
558
+              "description": ""
559
+            },
560
+            {
561
+              "name": "2 Mx",
562
+              "description": ""
563
+            },
564
+            {
565
+              "name": "3 Imperial",
566
+              "description": ""
567
+            }
568
+          ]
569
+        },
570
+        {
571
+          "name": "5 Nuts",
572
+          "description": ""
573
+        },
574
+        {
575
+          "name": "6 Pulleys",
576
+          "description": ""
577
+        },
578
+        {
579
+          "name": "7 Bearings",
580
+          "description": ""
581
+        },
582
+        {
583
+          "name": "8 Spacers",
584
+          "description": ""
585
+        },
586
+        {
587
+          "name": "9 Sliding things",
588
+          "description": ""
589
+        }
590
+      ]
591
+    },
592
+    {
593
+      "name": "5 Cables",
594
+      "description": "",
595
+      "children": [
596
+        {
597
+          "name": "1 Spools",
598
+          "description": ""
599
+        },
600
+        {
601
+          "name": "2 Ribbon Cable",
602
+          "description": ""
603
+        }
604
+      ]
605
+    },
606
+    {
607
+      "name": "6 Speakers and Buzzers",
608
+      "description": ""
609
+    },
610
+    {
611
+      "name": "V Modules",
612
+      "description": ""
613
+    },
614
+    {
615
+      "name": "W PC Stuff",
616
+      "description": ""
617
+    },
618
+    {
619
+      "name": "X PCB Material",
620
+      "description": ""
621
+    },
622
+    {
623
+      "name": "Y Other Stuff",
624
+      "description": ""
625
+    },
626
+    {
627
+      "name": "Z Projects",
628
+      "description": ""
629
+    },
630
+    {
631
+      "name": "U 3D Printing",
632
+      "description": ""
633
+    },
634
+    {
635
+      "name": "T Books",
636
+      "description": ""
637
+    },
638
+    {
639
+      "name": "# To test",
640
+      "description": ""
641
+    }
642
+  ]
643
+}

File diff suppressed because it is too large
+ 1491 - 0
src/categories.json


+ 20 - 0
src/main.rs View File

@@ -0,0 +1,20 @@
1
+#[macro_use] extern crate serde_json;
2
+#[macro_use] extern crate serde_derive;
3
+
4
+#[derive(Serialize,Deserialize,Debug,Clone)]
5
+struct Node {
6
+    #[serde(skip_serializing_if = "Option::is_none")]
7
+    name: Option<String>,
8
+    #[serde(skip_serializing_if = "Option::is_none")]
9
+    description: Option<String>,
10
+    #[serde(skip_serializing_if = "Vec::is_empty")]
11
+    children: Vec<Node>,
12
+}
13
+
14
+fn main() {
15
+    let source = include_str!("categories.json");
16
+
17
+    let parsed : Node = serde_json::from_str(source).expect("parse");
18
+
19
+    println!("{}", serde_json::to_string_pretty(&parsed).expect("serialize"));
20
+}