From 63cb8b478e8a6fd3c472459d6b5019b83113e1c2 Mon Sep 17 00:00:00 2001 From: PoolloverNathan <24194027+PoolloverNathan@users.noreply.github.com> Date: Mon, 8 Feb 2021 12:17:01 -0500 Subject: [PATCH] Hook into json module (when imported) Like the javascript version Yes, I know this is slightly overcomplicated --- json_minify/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/json_minify/__init__.py b/json_minify/__init__.py index d2a12e4..b0eb570 100644 --- a/json_minify/__init__.py +++ b/json_minify/__init__.py @@ -11,9 +11,12 @@ - Conditions and variable names changed - Reformatted tests and moved to separate file - Made into a PyPI Package + - Nathan Kulzer + - Hooked into json module, like the Javascript version """ import re +import json # to hook in def json_minify(string, strip_space=True): @@ -72,3 +75,5 @@ def json_minify(string, strip_space=True): new_str.append(string[index:]) return ''.join(new_str) + +json.minify = json_minify