json格式化就这么简单!ext版

json格式化就这么简单!ext版

var tjson = {
“task_name”: ” 数据库_kafka”,
“table_name”: “test3”,
“schema”: “cdc”,
“op”: “I”,
“change_id”: “58DA0968A8AA426786B976307F0C344A”,
“data”: {
“ID”: {
“int”: 3
},
“PASSWORD”: {
“string”: “3”
},
“NAME”: {
“string”: “33”
}
}
}

var json ='{“color_scheme”:”Packages/Predawn/predawn.tmTheme”,”default_line_ending”:”unix”,”findreplace_small”:true,”font_face”:”Source Code Pro”,”font_options”:[“no_bold”,”no_italic”],”font_size”:11,”ignored_packages”:[“Markdown”,”Vintage”],”rulers”:[80,100,120],”shift_tab_unindent”:true,”show_encoding”:true,”show_line_endings”:true,”tab_size”:4,”tabs_medium”:true,”theme”:”predawn.sublime-theme”,”translate_tabs_to_spaces”:true,”typescript_plugin_tsc_version”:”1.6.2″,”word_wrap”:true}’
alert(JSON.stringify(JSON.parse(json), null, 4))

var win=new Ext.Window({
id:’myWin’,
title:’示例’,
height:400,
width:”40%”,
layout: ‘fit’,
//closable:false,//禁用关闭按钮
draggable:false,//紧张拖拽
resizable:false,//固定大小,不允许拉伸
//collapsible:true,//可以折叠
// bodyStyle:’background:#fff; padding:10px;’,
items:[
{
xtype:’panel’,
bodyPadding: ’10 10 10 10′,
layout: ‘fit’,
items:[
{
xtype:’textarea’,
value:JSON.stringify(tjson, null, 4)
}
]
}
],
dockedItems: [
{
xtype: ‘toolbar’,
dock: ‘bottom’,
layout: {
type: ‘hbox’,
pack: ‘center’
},
items: [
{
xtype: ‘button’,
iconCls: ‘icon_close’,
text: ‘关闭’,
handler: function(button, e) {
button.up(“window”).close();
}
}
]
}
]
})
win.show();

2条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注