30 lines
539 B
C#
30 lines
539 B
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BS.Shared.Core
|
|
{
|
|
public static class JsonUtils
|
|
{
|
|
public static string ToSimpleJson(string key, object value)
|
|
{
|
|
var dict = new Dictionary<string, object>()
|
|
{
|
|
{key, value }
|
|
};
|
|
|
|
return JsonConvert.SerializeObject(dict);
|
|
}
|
|
|
|
public static string ToJson(Dictionary<string, object> dict)
|
|
{
|
|
var json = JsonConvert.SerializeObject(dict);
|
|
|
|
return json;
|
|
}
|
|
}
|
|
}
|