Commit 7635fa4
feat(audience): add Json.Serialize(dict, indent) pretty-print overload
Second overload indenting nested containers by `indent` spaces per
level. Round-trips through Deserialize identically; indent ≤ 0
routes to the existing compact Serialize, so every wire-payload
caller is unaffected.
Internal scaffolding:
- WriteObject / WriteArray / WriteValue thread indent + depth so the
overload can emit newlines and leading spaces at the correct
nesting level.
- AppendNewline helper centralises the "\n + (indent * depth) spaces"
pattern.
- pretty-path writes ":" with a trailing space; empty containers stay
on a single line ({} / []), matching the compact form for collapsed
nodes.
No behaviour change on the compact overload for any existing caller;
the indent threading is inert when indent == 0 (pretty=false).
Motivated by the sample-app landing next — its Init tab renders the
effective AudienceConfig as an echo view, and the Events/Identity
tabs show constructed property dicts, all via Json.Serialize(…, 2).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6ba9bb9 commit 7635fa4
1 file changed
Lines changed: 39 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
18 | 30 | | |
19 | 31 | | |
20 | 32 | | |
| |||
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
59 | | - | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
63 | | - | |
| 75 | + | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | | - | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
74 | 89 | | |
75 | 90 | | |
76 | 91 | | |
77 | | - | |
78 | | - | |
| 92 | + | |
79 | 93 | | |
| 94 | + | |
80 | 95 | | |
81 | | - | |
82 | | - | |
| 96 | + | |
| 97 | + | |
83 | 98 | | |
| 99 | + | |
84 | 100 | | |
85 | 101 | | |
86 | 102 | | |
87 | | - | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
90 | 109 | | |
91 | 110 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
95 | 114 | | |
| 115 | + | |
96 | 116 | | |
97 | 117 | | |
98 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
99 | 125 | | |
100 | 126 | | |
101 | 127 | | |
| |||
0 commit comments