A malformed map or a duplicate key fails parsing
All 12 scenarios hold
Values that do not open a map capture as plain strings.
expected outcome
broken scenario
| Scenario | Input | Parsed type? | Error message? |
|---|---|---|---|
| Quoted empty map | "[:]" | java.lang.String | |
| Missing opening bracket | :] | java.lang.String | |
| Unexpected leading character | a[:] | java.lang.String | |
| Missing closing bracket | [: | Failed to parse `[:` | |
| Closed by the wrong delimiter | [a: b} | Failed to parse `[a: b}` | |
| Double opening bracket | [[:] | Failed to parse `[[:]` | |
| Double closing bracket | [:]] | Failed to parse `]` | |
| Unexpected trailing character | [:]a | Failed to parse `a` | |
| Missing element | [a:b,] | Failed to parse `[a:b,]` | |
| Duplicate keys | [a:b, a:c] | Duplicate key `a` in map `[a:b, a:c]` | |
| Duplicate quoted key | [a:b, "a":c] | Duplicate key `a` in map `[a:b, "a":c]` | |
| Same key different value types | [a:b, a:[b], a:{b}, a:[b:c]] | Duplicate key `a` in map `[a:b, a:[b], a:{b}, a:[b:c]]` |