JSONObject.Create C# (CSharp) Method

Create() public static method

public static Create ( ) : JSONObject,
return JSONObject,
	public static JSONObject Create()
	{
#if POOLING
		JSONObject result = null;
		while(result == null && releaseQueue.Count > 0) {
			result = releaseQueue.Dequeue();
#if DEV
			//The following cases should NEVER HAPPEN (but they do...)
			if(result == null)
				Debug.Log("wtf " + releaseQueue.Count);
			else if(result.list != null)
				Debug.Log("wtflist " + result.list.Count);
#endif
		}
		if(result != null)
			return result;
#endif
		return new JSONObject();
	}
	public static JSONObject Create(Type t)

Same methods

JSONObject::Create ( AddJSONConents content ) : 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