Ejemplo n.º 1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="Embedded">Whether this data is embedded into another data structure.</param>
        /// <param name="IncludeCryptoHash">Include the crypto hash value of this object.</param>
        public JObject ToJSON(Boolean Embedded          = false,
                              InfoStatus ExpandTags     = InfoStatus.ShowIdOnly,
                              Boolean IncludeCryptoHash = false)

        => JSONObject.Create(

            new JProperty("@id", Id.ToString()),

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            Name.IsNeitherNullNorEmpty()
                       ? new JProperty("name", Name.ToJSON())
                       : null,

            Description.IsNeitherNullNorEmpty()
                       ? new JProperty("description", Description.ToJSON())
                       : null,

            new JProperty("creationDate", CreationDate.ToIso8601()),

            Tags.Any()
                       ? new JProperty("tags", Tags.SafeSelect(tag => tag.ToJSON(ExpandTags)))
                       : null,

            new JProperty("isDisabled", IsDisabled)

            );