From 021d517d5a42dc7aae88e6be968d92d9de8d9c9b Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Fri, 21 May 2021 16:04:45 +0900 Subject: [PATCH] include/json: Correctly escape braces in RegEx The json functions currently don't correctly recognize objects because braces aren't correctly escaped. This commit changes the regexes so that braces are escaped properly. --- include/json.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/json.sh b/include/json.sh index 1d009a5..341a240 100644 --- a/include/json.sh +++ b/include/json.sh @@ -31,7 +31,7 @@ json_object() { local re_array re_number='^[0-9]+$' - re_object='^{.*}$' + re_object='^\{.*\}$' re_array='^\[.*\]$' name="${!i}" @@ -73,7 +73,7 @@ json_array() { local re_array re_number='^[0-9]+$' - re_object='^{.*}$' + re_object='^\{.*\}$' re_array='^\[.*\]$' printf "[" -- 2.47.3