JSONObject.Create C# (CSharp) Method

Create() public static method

public static Create ( AddJSONConents content ) : JSONObject,
content AddJSONConents
return JSONObject,
	public static JSONObject Create(AddJSONConents content)
	{
		JSONObject obj = Create();
		content.Invoke(obj);
		return obj;
	}
	public static JSONObject Create(Dictionary<string, string> dic)

Same methods

JSONObject::Create ( ) : JSONObject,
JSONObject::Create ( string>.Dictionary dic ) : JSONObject,
JSONObject::Create ( Type t ) : JSONObject,
JSONObject::Create ( bool val ) : JSONObject,
JSONObject::Create ( float val ) : JSONObject,
JSONObject::Create ( int val ) : JSONObject,
JSONObject::Create ( string val, int maxDepth = -2, bool storeExcessLevels = false, bool strict = false ) : JSONObject,

Usage Example

Example #1
0
            public HTTPResponse.Builder ToHTTPResponseBuilder()
            {
                if (!Timestamp.HasValue)
                {
                    Timestamp = DateTime.UtcNow;
                }

                HTTPResponseBuilder.Server = Request.HTTPRequest.HTTPServer.DefaultServerName;
                HTTPResponseBuilder.Date   = Timestamp.Value;
                HTTPResponseBuilder.AccessControlAllowOrigin = "*";
                HTTPResponseBuilder.Connection = "close";

                if (Request.HTTPRequest.HTTPMethod != HTTPMethod.OPTIONS)
                {
                    HTTPResponseBuilder.ContentType = HTTPContentType.JSON_UTF8;

                    if (HTTPResponseBuilder.Content == null)
                    {
                        HTTPResponseBuilder.Content = JSONObject.Create(

                            Data != null
                                                              ? new JProperty("data", Data)
                                                              : null,

                            new JProperty("status_code", StatusCode ?? 2000),

                            StatusMessage.IsNotNullOrEmpty()
                                                              ? new JProperty("status_message", StatusMessage)
                                                              :  null,

                            AdditionalInformation.IsNotNullOrEmpty()
                                                              ? new JProperty("additionalInformation", AdditionalInformation)
                                                              : null,

                            RequestId.HasValue
                                                              ? new JProperty("requestId", RequestId.Value.ToString())
                                                              : null,

                            CorrelationId.HasValue
                                                              ? new JProperty("correlationId", CorrelationId.Value.ToString())
                                                              : null,

                            new JProperty("timestamp", (Timestamp ?? DateTime.UtcNow).ToIso8601())

                            ).ToUTF8Bytes();
                    }
                }

                HTTPResponseBuilder.Set("X-Request-ID", Request.RequestId).
                Set("X-Correlation-ID", Request.CorrelationId);

                HTTPResponseBuilder.SubprotocolResponse = this;

                return(HTTPResponseBuilder);
            }
All Usage Examples Of JSONObject::Create