Request.setcharacterencoding ("Utf-8");
Response.setcharacterencoding ("UTF-8");
Response.setcontenttype ("Text/plain;charset=utf-8");
Response.setheader ("Pragma", "No-cache");
Response.setheader ("Cache-control", "No-cache");
Response.setdateheader ("Expires", 0);//Set header file
Jsonarray jsonArray2 = jsonarray.fromobject (list);//Convert collection to JSON format
String jsonstring=jsonarray2.tostring ();//Convert JISN to a string
Response.getwriter (). print (jsonstring);//return JSON information
Note: The above method needs to be unpacked and placed in the Web project Lib under the package in my blog file has a jsonlib
$.post ("Hlsview?minename=" +minename,function (data) {// foreground data is the returned string
Layui.tree ({//Here is the data spanning tree structure that the Layui front end framework will get
Elem: ' #demo ',//demo ID is the DIV or UL you want to display the tree structure
Skin: "Shihuang"
, Nodes:data
, Click:function (node) {//Add a click Trigger event to the tree structure
if (node.url_name!= "")
Only_play (node.url_name);//Here is the method callback argument
}
});
}, "JSON");
How to convert a background list to JSON format