123456789101112131415161718192021222324252627 |
- using Common;
- using NuGet.DependencyResolver;
- namespace Util
- {
- /// <summary>
- /// Json任何类型读取到字符串属性
- /// 因为 System.Text.Json 必须严格遵守类型一致,当非字符串读取到字符属性时报错:
- /// The JSON value could not be converted to System.String.
- /// </summary>
- public class OpenFeign
- {
- public static T GetInfo<T>(string Url, string Param)
- {
- string ReturnData = Function.PostWebRequest(Url, Param);
- T Obj = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(ReturnData);
- return Obj;
- }
- public static List<T> GetList<T>(string Url, string Param)
- {
- string ReturnData = Function.PostWebRequest(Url, Param);
- List<T> List = Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(ReturnData);
- return List;
- }
- }
- }
|