def parse.json
import cswap-bend-cli@0.1.0.0/fmt/yaml.bend as Yamlimport Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/fmt/yamlr.bend as R
16# JSON is YAML: a document that opens with `{` or `[` is read as JSON when it
17# is JSON (nested flow collections, quoted keys), else by the block reader.
18def parse.json(r: Result<&2, &2, String, Json.Json>, +s: String) -> Result<&2, &2, String, Json.Json>:
19 match r:
20 case Done{j}:
21 Done{j}
22 case Fail{e}:
23 R.parse(s)