Commit 7d59b14
committed
json5: accept 'comment' fields in all JSON files
One complaint about the JSON5 format was that it has bad editor support. Well, actually
no editor support. Any valid JSON is valid JSON5 so you basically can use JSON as the
definition format for tests and suites, unfortunately you loose the ability to add
comments. In traditional JSON this is done by ignored fields, often just named 'comment'.
Unfortiunately the JSON5 decoder failes on unknown fields in a struct to prevent
ugly and hard to track bugs from typos.
This CL deliberately allows 'comment' everywhere in a JSON5 and won't fail if
the struct to unmarshal to has no such field. Such comments are just ignored.1 parent b01f796 commit 7d59b14
2 files changed
+13
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
598 | 600 | | |
599 | 601 | | |
600 | 602 | | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
606 | 613 | | |
607 | 614 | | |
608 | 615 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
0 commit comments