private IComparable PerformArithmeticOperation(IEvaluable evaluable, IJSONDocument document, ArithmeticOperation operation) { IJsonValue value1, value2; if (!Evaluate(out value1, document)) { return(null); } if (!evaluable.Evaluate(out value2, document)) { return(null); } TypeCode actualType1, actualType2; FieldDataType fieldDataType1 = JSONType.GetJSONType(value1.Value, out actualType1); FieldDataType fieldDataType2 = JSONType.GetJSONType(value2.Value, out actualType2); if (fieldDataType1.CompareTo(fieldDataType2) != 0) { return(null); } return(Evaluator.PerformArithmeticOperation(value1, actualType1, value2, actualType2, operation, fieldDataType1)); }
void CreateObject(JSONType type, string key) { JSON newObject = null; if (type == JSONType.Array) { newObject = new JSONArray(); } else { newObject = new JSONObject(); } if (_currentObject != null) { if (_currentObject.GetJSONType() == JSONType.Array) { _currentObject.AsArray().Add(newObject); } else { _currentObject.AsObject().Add(key, newObject); } } _stack.Push(newObject); _currentObject = newObject; MoveToNextNotEmptyPosition(); }
public string ToJSON(JSONType type) { switch (type) { case JSONType.Create: break; default: case JSONType.Update: throw new System.ApplicationException("Unsupported JSONType for BCCaptionSource"); } JSON.Builder builder = new JSON.Builder(); // only consider writing: displayName and url builder.Append("{"); builder.AppendField("displayName", displayName); if (!string.IsNullOrEmpty(url)) { builder.Append(",").AppendField("url", url); } builder.Append("}"); return(builder.ToString()); }
public void AddField(string name, JSONObject obj) { if (obj) { if (type != JSONType.OBJECT) { if (keys == null) { keys = new List <string>(); } if (type == JSONType.ARRAY) { for (int i = 0; i < list.Count; i++) { keys.Add(i + ""); } } else if (list == null) { list = new List <JSONObject>(); } type = JSONType.OBJECT; } keys.Add(name); list.Add(obj); } }
static public string GetTypeString(this JSONType t) { switch (t) { case JSONType.Array: return("Array"); case JSONType.Bool: return("Bool"); case JSONType.Null: return("Null"); case JSONType.Number: return("Number"); case JSONType.Object: return("Object"); case JSONType.String: return("String"); default: return(""); } }
private static string ToJSON(this BCPlaylist playlist, JSONType t) { //--Build Playlist in JSON -------------------------------------// Builder jsonPlaylist = new Builder(",", "{", "}"); //id if (t.Equals(JSONType.Update)) { jsonPlaylist.AppendObject("id", playlist.id.ToString()); } //name if (!string.IsNullOrEmpty(playlist.name)) { jsonPlaylist.AppendField("name", playlist.name); } //referenceId if (!string.IsNullOrEmpty(playlist.referenceId)) { jsonPlaylist.AppendField("referenceId", playlist.referenceId); } //playlist type jsonPlaylist.AppendField("playlistType", playlist.playlistType.ToString()); if (t.Equals(JSONType.Create)) { //Video Ids should be a list of strings if (playlist.videoIds != null && playlist.videoIds.Count > 0) { IEnumerable <string> values = from val in playlist.videoIds select val.ToString(); jsonPlaylist.AppendObjectArray("videoIds", values); } } //filter tags should be a list of strings if (playlist.filterTags != null && playlist.filterTags.Count > 0) { jsonPlaylist.AppendStringArray("filterTags", playlist.filterTags); } //shortDescription if (!string.IsNullOrEmpty(playlist.shortDescription)) { jsonPlaylist.AppendField("shortDescription", playlist.shortDescription); } //tagInclusionRule if (!string.IsNullOrEmpty(playlist.tagInclusionRule)) { jsonPlaylist.AppendField("tagInclusionRule", playlist.tagInclusionRule); } return(jsonPlaylist.ToString()); }
public void Bake() { if (type != JSONType.BAKED) { str = Print(); type = JSONType.BAKED; } }
public virtual IJSONDocument Transform(IJSONDocument document) { IJSONDocument newDocument; if (_criteria.GetAllFields) { newDocument = document.Clone() as IJSONDocument; } else { newDocument = JSONType.CreateNew(); } //if (!_criteria.IsGrouped) // newDocument.Key = document.Key; for (int i = 0; i < _criteria.ProjectionCount; i++) { IEvaluable field = _criteria[i]; IJsonValue finalValue; if (field.Evaluate(out finalValue, document)) { //newDocument[field.ToString()] = finalValue.Value; var binaryExpression = field as BinaryExpression; if (binaryExpression != null) { if (binaryExpression.Alias != null) { newDocument[binaryExpression.Alias] = finalValue.Value; continue; } } newDocument[field.CaseSensitiveInString] = finalValue.Value; } else { return(null); } } if (_criteria.ContainsOrder && !_criteria.IsGrouped) { _criteria.OrderByField.FillWithAttributes(document, newDocument); } else if (_criteria.IsGrouped) { _criteria.GroupByField.FillWithAttributes(document, newDocument); } if (newDocument.Count == 0) { return(null); } return(newDocument); }
public void Absorb(JSONObject obj) { list.AddRange(obj.list); keys.AddRange(obj.keys); str = obj.str; n = obj.n; b = obj.b; type = obj.type; }
public JSONField(string value, JSONType type) { String_Value = value.Trim(Input.DOUBLE_QUOTES); JSON_Type = type; if (type == JSONType.ARRAY || type == JSONType.OBJECT) { throw new JSONException("Inappropriate type for JSONField"); } }
public int TestUpdateUserInfo(string user, string pass, string searchedUser, JSONType type) { Respuesta res = usrSrv.UpdateUserInfo(user, pass, searchedUser, getTestJSON(type)); if (res.Code == 403) { usrSrv.DelteNode("usuarios_info/" + searchedUser); } return(res.Code); }
private string FilePathJSON(JSONType jsonType, string filenameTag = null) { string filename = jsonType.ToString(); if (filenameTag != null) { filename = filename + "_" + filenameTag; } return(Path.Combine(_dirJSON, filename + ".json")); }
public JSONObject(Dictionary<string, JSONObject> dic) { type = JSONType.OBJECT; keys = new List<string>(); list = new List<JSONObject>(); foreach(KeyValuePair<string, JSONObject> kvp in dic) { keys.Add(kvp.Key); list.Add(kvp.Value); } }
public JSONObject(Dictionary <string, JSONObject> dic) { type = JSONType.OBJECT; keys = new List <string>(); list = new List <JSONObject>(); foreach (KeyValuePair <string, JSONObject> kvp in dic) { keys.Add(kvp.Key); list.Add(kvp.Value); } }
public JSONElement(JSONType type) { this.type = type; if (type == JSONType.LIST || type == JSONType.DIC) { this.data = new List <JSONElement>(); } if (type == JSONType.DIC) { this.key = new List <string>(); } }
private string getTestJSON(JSONType type) { string userInfoJSON = ""; switch (type) { case JSONType.Valid: userInfoJSON = @"{ 'correo': '*****@*****.**', 'nombre': 'Fulano Lopez', 'rol': 'ventas', 'telefono': '222-7-18-43-56' }"; break; case JSONType.Invalid: userInfoJSON = @"{ 'correo': '*****@*****.**', 'rol': 'ventas', 'telefono': '222-7-18-43-56' }"; break; case JSONType.Malformed: userInfoJSON = @"{ 'correo': '[email protected] 'rol': 'ventas', 'telefono': '222-7-18-43-56' }"; break; case JSONType.PartialValid: userInfoJSON = @"{ 'correo': '*****@*****.**' }"; break; case JSONType.PartialInvalid: userInfoJSON = @"{ 'correo': '' }"; break; case JSONType.PartialMalformed: userInfoJSON = @"{ 'correo': ' }"; break; } return(userInfoJSON); }
public override IEnumerable <KeyValuePair <AttributeValue, long> > Enumerate(QueryCriteria value) { IQueryStore tempCollection = value.SubstituteStore; IJSONDocument doc = JSONType.CreateNew(); doc.Add("$count(*)", _count); doc.Key = Guid.NewGuid().ToString(); tempCollection.InsertDocument(doc, null); var rowid = tempCollection.GetRowId(new DocumentKey(doc.Key)); value.Store = tempCollection; value.GroupByField = new AllField(Field.FieldType.Grouped); yield return(new KeyValuePair <AttributeValue, long>(NullValue.Null, rowid)); }
public JSONObject(JSONType t) { type = t; switch(t) { case JSONType.ARRAY: list = new List<JSONObject>(); break; case JSONType.OBJECT: list = new List<JSONObject>(); keys = new List<string>(); break; } }
public void Clear() { type = JSONType.NULL; if (list != null) { list.Clear(); } if (keys != null) { keys.Clear(); } str = ""; n = 0; b = false; }
public JSONObject(JSONType t) { type = t; switch (t) { case JSONType.ARRAY: list = new List <JSONObject>(); break; case JSONType.OBJECT: list = new List <JSONObject>(); keys = new List <string>(); break; } }
public void Add(JSONObject obj) { if (obj) { if (type != JSONType.ARRAY) { type = JSONType.ARRAY; if (list == null) { list = new List <JSONObject>(); } } list.Add(obj); } }
private void handleFields(ref JSONObject root) { if (hasKey(File_Data[Index])) { Key = extractKey(File_Data[Index]); if (hasValue(File_Data[Index])) { string value = extractFieldValue(File_Data[Index]); JSONType type = determineType(value); if (isFieldType(type)) { root.addField(Key, new JSONField(value, type)); } } Index++; } }
public IEnumerable BakeAsync() { if (type != JSONType.BAKED) { foreach (string s in PrintAsync()) { if (s == null) { yield return(s); } else { str = s; } } type = JSONType.BAKED; } }
public static JSONObject Create(JSONType t) { JSONObject obj = Create(); obj.type = t; switch (t) { case JSONType.ARRAY: obj.list = new List <JSONObject>(); break; case JSONType.OBJECT: obj.list = new List <JSONObject>(); obj.keys = new List <string>(); break; } return(obj); }
public void ApplyValue(params object[] values) { if (values != null && values.Length > 0) { if (values[0] != null) { FieldDataType type = JSONType.GetJSONType(values[0]); switch (type) { case FieldDataType.Number: _sum += Convert.ToDouble(values[0]); break; case FieldDataType.DateTime: _sum += Convert.ToDateTime(values[0]).ToOADate(); break; } } } }
public override IEnumerable <KeyValuePair <AttributeValue, long> > Enumerate(QueryCriteria value) { _filterDocument = JSONType.CreateNew(); if (_childPredicates.Count > 0) { foreach (var childPredicate in _childPredicates) { var predicate = childPredicate as TerminalPredicate; if (predicate != null) { foreach (var kvp in predicate.Enumerate(value)) { _filterDocument.Clear(); PopulateDocument(kvp.Key, predicate.Source.Attributes); if (_condition.IsTrue(_filterDocument)) { yield return(kvp); } } } } } }
public override IJsonValue Evaluate(IJSONDocument document) { JSONResult result = (JSONResult)document; if (result != null) { IAggregation aggregation = result.GetAggregation(Name); if (aggregation != null) { FieldDataType dataType = JSONType.GetJSONType(aggregation.Value); switch (dataType) { case FieldDataType.Number: return(new NumberJsonValue(aggregation.Value)); case FieldDataType.String: return(new StringJsonValue((string)aggregation.Value)); case FieldDataType.Null: return(new NullValue()); case FieldDataType.Object: return(new ObjectJsonValue((IJSONDocument)aggregation.Value)); case FieldDataType.DateTime: return(new DateTimeJsonValue((DateTime)aggregation.Value)); case FieldDataType.Bool: return(new BooleanJsonValue((bool)aggregation.Value)); case FieldDataType.Array: return(new ArrayJsonValue((IJsonValue[])aggregation.Value)); } } } return(base.Evaluate(document)); }
public string ToJSON(JSONType type) { switch (type) { case JSONType.Create: break; default: case JSONType.Update: throw new System.ApplicationException("Unsupported JSONType for BCCaptionSource"); } JSON.Builder builder = new JSON.Builder(); // only consider writing: displayName and url builder.Append("{"); builder.AppendField("displayName", displayName); if (!string.IsNullOrEmpty(url)) builder.Append(",").AppendField("url", url); builder.Append("}"); return builder.ToString(); }
public IEnumerable BakeAsync () { if (type != JSONType.BAKED) { foreach (string s in PrintAsync()) { if (s == null) { yield return s; } else { str = s; } } type = JSONType.BAKED; } }
public void Clear() { type = JSONType.NULL; if(list != null) { list.Clear(); } if(keys != null) { keys.Clear(); } str = ""; n = 0; b = false; }
public JSONObject(double d) { type = JSONType.NUMBER; n = d; }
public JSONObject(bool b) { type = JSONType.BOOL; this.b = b; }
public void AddField (string name, JSONObject obj) { if (obj) { if (type != JSONType.OBJECT) { if (keys == null) { keys = new List<string>(); } if (type == JSONType.ARRAY) { for (int i = 0; i < list.Count; i++) { keys.Add(i + ""); } } else if (list == null) { list = new List<JSONObject>(); } type = JSONType.OBJECT; } keys.Add(name); list.Add(obj); } }
public override IEnumerable <KeyValuePair <AttributeValue, long> > Enumerate(QueryCriteria value) { IQueryStore tempCollection = value.SubstituteStore; var key = new DocumentKey(); var finalResultSet = new SortedDictionary <AttributeValue, long>(); if (_childPredicates != null) { foreach (var childPredicate in _childPredicates) { var predicate = childPredicate as TerminalPredicate; if (predicate != null) { foreach (var kvp in predicate.Enumerate(value)) { var newDocument = value.Store.GetDocument(kvp.Value, null); if (newDocument == null) { continue; } AttributeValue newKey; if (value.GroupByField.GetAttributeValue(newDocument, out newKey)) { key.Value = newKey.ValueInString; if (finalResultSet.ContainsKey(newKey)) { if (value.ContainsAggregations) { var groupDocument = tempCollection.GetDocument(finalResultSet[newKey], null); foreach (var aggregation in value.Aggregations) { IJsonValue calculatedValue; if (aggregation.Evaluation.Evaluate(out calculatedValue, newDocument)) { aggregation.Aggregation.Value = groupDocument[aggregation.FieldName]; aggregation.Aggregation.ApplyValue(calculatedValue.Value); groupDocument[aggregation.FieldName] = aggregation.Aggregation.Value; } } tempCollection.UpdateDocument(finalResultSet[newKey], groupDocument, new OperationContext()); } } else { var aggregateDocument = JSONType.CreateNew(); value.GroupByField.FillWithAttributes(newDocument, aggregateDocument); if (value.ContainsAggregations) { foreach (var aggregation in value.Aggregations) { IJsonValue calculatedValue; if (aggregation.Evaluation.Evaluate(out calculatedValue, newDocument)) { aggregation.Reset(); aggregation.Aggregation.ApplyValue(calculatedValue.Value); aggregateDocument[aggregation.FieldName] = aggregation.Aggregation.Value; } } } aggregateDocument.Key = key.Value as string; tempCollection.InsertDocument(aggregateDocument, new OperationContext()); long newRowId = tempCollection.GetRowId(key); finalResultSet.Add(newKey, newRowId); } } } } } } if (finalResultSet.Count == 0) { var emptyDoc = JSONType.CreateNew(); if (value.ContainsAggregations) { foreach (var aggregation in value.Aggregations) { emptyDoc[aggregation.FieldName] = 0; } } key.Value = value.GroupByField.FieldId.ToString(); emptyDoc.Key = (string)key.Value; tempCollection.InsertDocument(emptyDoc, new OperationContext()); finalResultSet.Add(new NullValue(), tempCollection.GetRowId(key)); } value.Store = tempCollection; return(finalResultSet); }
public void SetImage() { if (this.ValueType != JSONType.Object && this.ValueType != JSONType.ObjectArray) { return; } if (this.ContainsOnlyObjects && this.ChildJSONObjects.Count > 1) { this.TreeNode.ImageIndex = 2; this.TreeNode.SelectedImageIndex = 2; this.ValueType = JSONType.ObjectArray; } else if (this.ContainsObjects) { this.TreeNode.ImageIndex = 0; this.TreeNode.SelectedImageIndex = 0; this.ValueType = JSONType.Object; } else { this.TreeNode.ImageIndex = 1; this.TreeNode.SelectedImageIndex = 1; this.ValueType = JSONType.Object; } }
void Parse (string str, int maxDepth, bool storeExcessLevels, bool strict) { if (!string.IsNullOrEmpty(str)) { str = str.Trim(JSONWhitespace); if (strict) { if(str[0] != '[' && str[0] != '{') { type = JSONType.NULL; Debug.LogWarning("Improper (strict) JSON formatting. First character must be [ or {"); return; } } if (str.Length > 0) { if (string.Compare(str, "true", true) == 0) { type = JSONType.BOOL; b = true; } else if (string.Compare(str, "false", true) == 0) { type = JSONType.BOOL; b = false; } else if (string.Compare(str, "null", true) == 0) { type = JSONType.NULL; } else if (str == JSONInfinity) { type = JSONType.NUMBER; n = double.PositiveInfinity; } else if (str == JSONNegativeInfinity) { type = JSONType.NUMBER; n = double.NegativeInfinity; } else if (str == JSONNotANumber) { type = JSONType.NUMBER; n = double.NaN; } else if (str[0] == '"') { type = JSONType.STRING; this.str = str.Substring(1, str.Length - 2); } else { int tokenTmp = 1; int offset = 0; switch (str[offset]) { case '{': type = JSONType.OBJECT; keys = new List<string>(); list = new List<JSONObject>(); break; case '[': type = JSONType.ARRAY; list = new List<JSONObject>(); break; default: try { n = System.Convert.ToDouble(str); type = JSONType.NUMBER; } catch (System.FormatException) { type = JSONType.NULL; Debug.LogWarning("improper JSON formatting:" + str); } return; } string propName = ""; bool openQuote = false; bool inProp = false; int depth = 0; while (++offset < str.Length) { if (System.Array.IndexOf(JSONWhitespace, str[offset]) > -1) { continue; } if (str[offset] == '\\') { offset += 1; continue; } if (str[offset] == '"') { if (openQuote) { if (!inProp && depth == 0 && type == JSONType.OBJECT) { propName = str.Substring(tokenTmp + 1, offset - tokenTmp - 1); } openQuote = false; } else { if(depth == 0 && type == JSONType.OBJECT) { tokenTmp = offset; } openQuote = true; } } if (openQuote) { continue; } if (type == JSONType.OBJECT && depth == 0) { if(str[offset] == ':') { tokenTmp = offset + 1; inProp = true; } } if(str[offset] == '[' || str[offset] == '{') { depth++; } else if (str[offset] == ']' || str[offset] == '}') { depth--; } if ((str[offset] == ',' && depth == 0) || depth < 0) { inProp = false; string inner = str.Substring(tokenTmp, offset - tokenTmp).Trim(JSONWhitespace); if(inner.Length > 0) { if(type == JSONType.OBJECT) { keys.Add(propName); } if(maxDepth != -1) { list.Add(Create(inner, (maxDepth < -1) ? -2 : maxDepth - 1)); } else if (storeExcessLevels) { list.Add(CreateBakedObject(inner)); } } tokenTmp = offset + 1; } } } } else { type = JSONType.NULL; } } else { type = JSONType.NULL; } }
public static JSONObject Create (JSONType t) { JSONObject obj = Create(); obj.type = t; switch (t) { case JSONType.ARRAY: obj.list = new List<JSONObject>(); break; case JSONType.OBJECT: obj.list = new List<JSONObject>(); obj.keys = new List<string>(); break; } return obj; }
public void Absorb (JSONObject obj) { list.AddRange(obj.list); keys.AddRange(obj.keys); str = obj.str; n = obj.n; b = obj.b; type = obj.type; }
protected JSON(JSONType type) { _parent = null; _type = type; }
public void BuildTree(TreeView Tree) { Tree.Nodes.Clear(); this.ValueType = JSONType.ObjectArray; this.TreeNode.Text = "Root"; Tree.Nodes.Add(this.TreeNode); this.BuildTree(); this.TreeNode.ExpandAll(); }
public void Add (JSONObject obj) { if (obj) { if (type != JSONType.ARRAY) { type = JSONType.ARRAY; if (list == null) { list = new List<JSONObject>(); } } list.Add(obj); } }
public JSONObject (JSONObject[] objs) { type = JSONType.ARRAY; list = new List<JSONObject>(objs); }
private static string ToJSON(this BCPlaylist playlist, JSONType t) { //--Build Playlist in JSON -------------------------------------// StringBuilder jsonPlaylist = new StringBuilder(); //id if (t.Equals(JSONType.Update)) { jsonPlaylist.Append("\"id\": " + playlist.id.ToString()); } //name if (!string.IsNullOrEmpty(playlist.name)) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"name\": \"" + playlist.name + "\""); } //referenceId if (!string.IsNullOrEmpty(playlist.referenceId)) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"referenceId\": \"" + playlist.referenceId + "\""); } //thumbnailURL if (!string.IsNullOrEmpty(playlist.thumbnailURL)) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"thumbnailURL\": \"" + playlist.thumbnailURL + "\""); } //playlist type if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"playlistType\": \"" + playlist.playlistType.ToString() + "\""); if (t.Equals(JSONType.Create) || t.Equals(JSONType.Update)) { //Video Ids should be a list of strings if (playlist.videoIds != null && playlist.videoIds.Count > 0) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"videoIds\": ["); string append = ""; foreach (long id in playlist.videoIds) { jsonPlaylist.Append(append + "" + id.ToString() + ""); append = ","; } jsonPlaylist.Append("]"); } } //filter tags should be a list of strings if (playlist.filterTags != null && playlist.filterTags.Count > 0) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"filterTags\": ["); string append = ""; foreach (string tag in playlist.filterTags) { jsonPlaylist.Append(append + "\"" + tag + "\""); append = ","; } jsonPlaylist.Append("]"); } //shortDescription if (!string.IsNullOrEmpty(playlist.shortDescription)) { if (jsonPlaylist.Length > 0) { jsonPlaylist.Append(","); } jsonPlaylist.Append("\"shortDescription\": \"" + playlist.shortDescription + "\""); } return("{" + jsonPlaylist.ToString() + "}"); }
public JSONObject() { type = State.JSONType.Object; }
private static string ToJSON(this BCVideo video, JSONType type) { //--Build Video in JSON -------------------------------------// StringBuilder jsonVideo = new StringBuilder(); jsonVideo.Append("{"); if (type.Equals(JSONType.Update)) { //id jsonVideo.Append("\"id\": " + video.id.ToString() + ","); } //name if (!string.IsNullOrEmpty(video.name)) { jsonVideo.Append("\"name\": \"" + video.name + "\""); } //shortDescription if (!string.IsNullOrEmpty(video.shortDescription)) { jsonVideo.Append(",\"shortDescription\": \"" + video.shortDescription + "\""); } //Tags should be a list of strings if (video.tags.Count > 0) { jsonVideo.Append(",\"tags\": ["); string append = ""; foreach (string tag in video.tags) { jsonVideo.Append(append + "\"" + tag + "\""); append = ","; } jsonVideo.Append("]"); } // Custom Fields should be a list of strings if (video.customFields.Values.Count > 0) { jsonVideo.Append(",\"customFields\": {"); string append = ""; foreach (string key in video.customFields.Values.Keys) { jsonVideo.Append(append + "\"" + key + "\": \"" + video.customFields.Values[key] + "\""); append = ","; } jsonVideo.Append("}"); } //referenceId if (!string.IsNullOrEmpty(video.referenceId)) { jsonVideo.Append(",\"referenceId\": \"" + video.referenceId + "\""); } //longDescription if (!string.IsNullOrEmpty(video.longDescription)) { jsonVideo.Append(",\"longDescription\": \"" + video.longDescription + "\""); } if (!string.IsNullOrEmpty(video.linkText)) { jsonVideo.Append(",\"linkText\": \"" + video.linkText + "\""); } if (!string.IsNullOrEmpty(video.linkURL)) { jsonVideo.Append(",\"linkURL\": \"" + video.linkURL + "\""); } if (!string.IsNullOrEmpty(video.thumbnailURL)) { jsonVideo.Append(",\"thumbnailURL\": \"" + video.thumbnailURL + "\""); } if (!string.IsNullOrEmpty(video.videoStillURL)) { jsonVideo.Append(",\"videoStillURL\": \"" + video.videoStillURL + "\""); } if (video.cuePoints.Count > 0) { jsonVideo.Append(",\"cuePoints\": " + video.cuePoints.ToJSON()); } //economics jsonVideo.Append(",\"economics\": \"" + video.economics.ToString() + "\""); // Start Date jsonVideo.Append(",\"startDate\": "); if (string.IsNullOrEmpty(video.startDate)) { jsonVideo.Append("null"); } else { jsonVideo.Append("\"" + video.startDate + "\""); } // End Date jsonVideo.Append(",\"endDate\": "); if (string.IsNullOrEmpty(video.endDate)) { jsonVideo.Append("null"); } else { jsonVideo.Append("\"" + video.endDate + "\""); } jsonVideo.Append("}"); return(jsonVideo.ToString()); }