From 5b16db3a9d109027d02c3281c8e2b61ec32c13ca Mon Sep 17 00:00:00 2001 From: Mischa Poslawsky Date: Mon, 26 Oct 2020 22:36:20 +0100 Subject: [PATCH] parse-wormedit: json format option Alternative to YAML for simpler data exchange. --- parse-wormedit | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parse-wormedit b/parse-wormedit index cf1798d..aa22051 100755 --- a/parse-wormedit +++ b/parse-wormedit @@ -54,7 +54,7 @@ else { if ($opt{output}) {{ # derive format from file extension - if ($opt{output} =~ /\.(yaml|txt)$/) { + if ($opt{output} =~ /\.(yaml|json|txt)$/) { $opt{format} //= $1 } else { @@ -70,6 +70,10 @@ if ($opt{output}) {{ # output with user-preferred formatting given ($opt{format}) { +when ('json') { + require JSON; + say JSON->new->encode($data); +} when ('yaml') { # full data in yaml (human-readable) formatting require YAML; @@ -201,6 +205,10 @@ Plain text summary of levelpack contents. All parsed data in YAML syntax. +=item json + +Parsed data in JSON syntax. + =item pnm, png, bmp, ... Image drawing of rendered levels. -- 2.30.0