using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRaCIS.Core.Domain.Common
{
    public static class JJsonConvert
    {
        /// <summary>
        /// 将对象序列化成稽查需要的Json字符串
        /// </summary>
        /// <param name="obj">需要序列化的对象</param>
        /// <returns></returns>
        public static string ToJcJson(this object obj)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings();
            settings.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
            settings.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
            return JsonConvert.SerializeObject(obj, settings);
        }
    }
}
