diff --git a/devdocs/todo.txt b/devdocs/todo.txt
index a4d12241..6565c241 100644
--- a/devdocs/todo.txt
+++ b/devdocs/todo.txt
@@ -18,6 +18,7 @@ DO CLIENT STUFF NOW COME BACK TO THIS STUFF LATER
NOW: Figure out formcustom template, is it supposed to be an array or an object. I might have fucked it up in the seeder code and made it an object when it's jsut an array normally
NOW: Clean the JSON that comes from the client or wherever, it has a lot of fluff in it like extra carriage returns etc. No need to store that shit in the DB.
+TODO: Search in widgetbiz and userbiz etc needs to also work on custom fields
*** BEFORE NEXT UPDATE TO DEVOPS SERVER:::::::
TODO: 2019-06-07 10:47:57.8894|WARN|Microsoft.AspNetCore.Cors.Infrastructure.CorsService|The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported.
diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs
index 8fca71d0..6e1ca1da 100644
--- a/server/AyaNova/biz/WidgetBiz.cs
+++ b/server/AyaNova/biz/WidgetBiz.cs
@@ -90,6 +90,7 @@ namespace AyaNova.Biz
outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
+ outObj.CustomFields=JsonUtil.CompactJson(outObj.CustomFields);
await ct.Widget.AddAsync(outObj);
await ct.SaveChangesAsync();
@@ -117,6 +118,7 @@ namespace AyaNova.Biz
//Test get serial id visible id number from generator
outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
+ outObj.CustomFields=JsonUtil.CompactJson(outObj.CustomFields);
TempContext.Widget.Add(outObj);
TempContext.SaveChanges();
@@ -174,6 +176,7 @@ namespace AyaNova.Biz
CopyObject.Copy(inObj, dbObj, "Id,Serial");
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
+ dbObj.CustomFields=JsonUtil.CompactJson(dbObj.CustomFields);
//Set "original" value of concurrency token to input token
//this will allow EF to check it out
@@ -207,6 +210,7 @@ namespace AyaNova.Biz
objectPatch.ApplyTo(dbObj);
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
+ dbObj.CustomFields=JsonUtil.CompactJson(dbObj.CustomFields);
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
Validate(dbObj, SnapshotOfOriginalDBObj);
diff --git a/server/AyaNova/util/JsonUtil.cs b/server/AyaNova/util/JsonUtil.cs
new file mode 100644
index 00000000..f2e05c0b
--- /dev/null
+++ b/server/AyaNova/util/JsonUtil.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Linq;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace AyaNova.Util
+{
+
+
+ internal static class JsonUtil
+ {
+
+ ///
+ /// Clean JSON string fragment, remove unnecessary characters
+ /// can be called with anything and should handle it properly even empty values etc
+ ///
+ ///
+ ///
+ public static string CompactJson(string jsonIn)
+ {
+ if (string.IsNullOrWhiteSpace(jsonIn))
+ {
+ return jsonIn;
+ }
+ if (jsonIn.StartsWith("["))
+ {
+ JArray j = JArray.Parse(jsonIn);
+ return JsonConvert.SerializeObject(j, Formatting.None);
+ }
+
+ if (jsonIn.StartsWith("{"))
+ {
+ JObject j = JObject.Parse(jsonIn);
+ return JsonConvert.SerializeObject(j, Formatting.None);
+ }
+
+ //Not an object or an array so just return it, possibly suspect, maybe log this shit
+ return jsonIn;
+ }
+
+
+ }//eoc
+
+}//eons
\ No newline at end of file