diff --git a/LearnositySDK/Utils/JsonObjectFactory.cs b/LearnositySDK/Utils/JsonObjectFactory.cs index ea49762..22abbe5 100755 --- a/LearnositySDK/Utils/JsonObjectFactory.cs +++ b/LearnositySDK/Utils/JsonObjectFactory.cs @@ -5,6 +5,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.IO; +using System.Numerics; +using System.Xml.Linq; namespace LearnositySDK.Utils { @@ -98,7 +100,14 @@ public static JsonObject fromJToken(JsonObject jsonObject, string key, JToken it jsonObject.set(key, (int)item); break; case JTokenType.Float: - jsonObject.set(key, (decimal)item); + try + { + jsonObject.set(key, (float) item); + } + catch (OverflowException) + { + jsonObject.set(key, float.MaxValue); + } break; case JTokenType.String: jsonObject.set(key, (string)item);