Example #1
0
        /// <summary>
        /// Create a JSON array using the given JSON properties, but filter null values.
        /// </summary>
        /// <param name="JProperties">JSON properties.</param>
        public static JArray Create(params JProperty[] JProperties)
        {
            if (JProperties == null)
            {
                return(new JArray());
            }

            var data = JProperties.Where(jproperty => jproperty != null).ToArray();

            return(data.Length > 0 ? new JArray(data) : new JArray());
        }
Example #2
0
        /// <summary>
        /// Create a JSON object using the given JSON properties, but filter null values.
        /// </summary>
        /// <param name="JProperties">JSON properties.</param>
        public static JObject Create(params JProperty[] JProperties)

        => new JObject(JProperties.Where(jproperty => jproperty != null));