Skip to content

Commit 6e9690a

Browse files
authored
Merge pull request #13 from Learnosity/LRN-10530
[BUG] Set format and culture when converting float to string in JsonObject
2 parents 900a1fa + a75d34b commit 6e9690a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

LearnositySDK/Utils/JsonObject.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections;
66
using Newtonsoft.Json;
77
using Newtonsoft.Json.Linq;
8+
using System.Globalization;
89

910
namespace LearnositySDK.Utils
1011
{
@@ -626,7 +627,7 @@ public string toJson()
626627
}
627628
else if (this.df.ContainsKey(key))
628629
{
629-
sb.Append(this.df[key].ToString());
630+
sb.Append(this.df[key].ToString("R", CultureInfo.InvariantCulture));
630631
}
631632
else if (this.ds.ContainsKey(key))
632633
{
@@ -677,7 +678,7 @@ public string toJson()
677678
sb.Append(",");
678679
}
679680

680-
sb.Append(Json.encode(item.Key) + ":" + item.Value.ToString());
681+
sb.Append(Json.encode(item.Key) + ":" + item.Value.ToString("R", CultureInfo.InvariantCulture));
681682

682683
index++;
683684
}

0 commit comments

Comments
 (0)