How to convert a background list to JSON format

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.