From e48a4054d2f486f35840bc267b9e80d64d76141d Mon Sep 17 00:00:00 2001 From: Arunesh Dwivedi Date: Tue, 9 Jun 2026 09:59:48 +0000 Subject: [PATCH] fix: preserve version strings with trailing zeros in JSON parsing Version strings like "1.30" were being truncated to "1.3" because json.loads() converts them to floats, losing the trailing zero. Changed json.loads(plan_lines) to json.loads(plan_lines, parse_float=str) to preserve the original string representation of numeric values. Fixes #752 Signed-off-by: Arunesh Dwivedi " --- terraform_compliance/common/readable_plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform_compliance/common/readable_plan.py b/terraform_compliance/common/readable_plan.py index 64becb16..1f826fb2 100644 --- a/terraform_compliance/common/readable_plan.py +++ b/terraform_compliance/common/readable_plan.py @@ -52,7 +52,7 @@ def __call__(self, parser, namespace, values, option_string=None): else: plan_lines = plan_lines[0] - data = json.loads(plan_lines) + data = json.loads(plan_lines, parse_float=str) # Preserve version strings like "1.30" # Write the changed plan file to the same file, since it is used in other places. if file_change_required: