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
/*
In Serde terms, *transcoding* means:
- deserialize from one format (JSON)
- immediately serialize into another format (YAML)
- without building a Rust struct/enum in the middle
Why?
----------------------
- You have data in JSON and want to emit YAML.
- You want to preserve the general structure without writing a schema.
- You want streaming behavior (in general). In this particular example we
use `from_str` for simplicity, but the same approach works with readers.
How?
-------------------------
1) `serde_json::Deserializer` reads JSON and produces Serde "events".
2) `serde_saphyr::Serializer` consumes the same events and writes YAML.
3) `serde_transcode::transcode` connects the two.
Serde is the common language in the middle.
We are not converting JSON -> `serde_json::Value` -> YAML.
*/