From b872721206685109c62bc893e2e6bf855a911fd1 Mon Sep 17 00:00:00 2001 From: Travis Leith Date: Sat, 2 Jan 2021 22:52:10 +0000 Subject: [PATCH] strings with invalid json characters are now handled correctly --- src/Encode.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Encode.fs b/src/Encode.fs index cfff75a..8e57f07 100644 --- a/src/Encode.fs +++ b/src/Encode.fs @@ -21,7 +21,9 @@ module Encode = ///**Exceptions** /// let string (value : string) : JsonValue = - JValue(value) :> JsonValue + match value with + |null -> JValue(value) :> JsonValue + |_ -> JsonConvert.ToString(value) |> JToken.Parse ///**Description** /// Encode a GUID