Skip to content

ccwant/ForceJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ForceJson

License

C#和Asp.Net版的Json解析工具类,是从java中移植JsonObject到.Net中的,使用方法和api和java中的JsonObject完全一致

创建JSONObject示例

JSONObject json = new JSONObject();  
json.Put("sex", "男");  
json.Put("age", 123);  
json.Put("name", "张三");  
Console.WriteLine(json.ToString()); 

创建JSONArray示例

JSONObject json = new JSONObject();  
json.Put("sex", "男");  
json.Put("age", 123);  
json.Put("name", "张三");  
JSONArray array = new JSONArray();  
array.Put(json);  
Console.WriteLine(array.ToString());  

解析示例

JSONObject json = new JSONObject("{'sex':'男','name':'张三','data':[{'book':'一本书'},{'book':'二本书'}]}");  
Console.WriteLine(json.Get("sex"));  
Console.WriteLine(json.Get("name"));  
JSONArray datas = json.GetJSONArray("data");  
Console.WriteLine(datas.GetJSONObject(0).GetString("book"));  

下载

Download

About

C#和.Net版的JsonObject解析工具类

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages