From b782fde941a5217a5ddca4d4b907b57cd8e02c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaarlo=20R=C3=A4ih=C3=A4?= Date: Sun, 26 Aug 2018 10:57:27 +0300 Subject: [PATCH] Implement one Json5.Parse overload This fixes following test cases: ModifiesPropertyValuesTest ModifiesNestedObjectPropertyValuesTest DeletesPropertyValuesTest ModifiesArrayValuesTest ModifiesNestedArrayValuesTest --- Json5/Json5.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Json5/Json5.cs b/Json5/Json5.cs index 81a742d..7619656 100644 --- a/Json5/Json5.cs +++ b/Json5/Json5.cs @@ -32,7 +32,16 @@ public static Json5Value Parse(string text, Func reviver) { - throw new NotImplementedException(); + Json5Parser parser = new Json5Parser(new StringReader(text)); + Json5Value value = parser.Parse(); + + if (reviver != null) + { + Func finalReviver = (t, k, v) => reviver(k, v); + return Transform(value, finalReviver); + } + + return value; } public static string Stringify(Json5Value value, Func replacer, string space = null)