JSON字符串转JSON对象_javascript技巧

适用酒店O2O菜单

var stri = [
    //会员中心
    { "menucode": 1, "menuname": "会员中心", },
    { "menucode": 1, "name": "会员查询", "perm_id": 1, SubsMenu: [{ "perm_id": 1, "menueurl": "Customer/Index", "menuename": "会员查询" }] },
  { "menucode": 1, "name": "签到送积分", "perm_id": 4, SubsMenu: [{ "perm_id": 4, "menueurl": "IntegralPoints/set", "menuename": "签到送积分" }] },
  { "menucode": 1, "name": "会员等级设置", "perm_id": 5, SubsMenu: [{ "perm_id": 5, "menueurl": "Level/set", "menuename": "会员等级设置" }] },
  { "menucode": 1, "name": "储值管理", "perm_id": 9, SubsMenu: [{ "perm_id": 9, "menueurl": "StoredPackages/List", "menuename": "储值管理" }] },
  { "menucode": 1, "name": "会员俱乐部", "perm_id": 60, SubsMenu: [{ "perm_id": 60, "menueurl": "Hotel/HeikahuiIntroduce", "menuename": "会员俱乐部" }] },
    //订单中心
    { "menucode": 2, "menuname": "订单中心", },
    { "menucode": 2, "name": "客房订单", "perm_id": 10, SubsMenu: [{ "perm_id": 10, "menueurl": "Order/Index", "menuename": "客房订单" }] },
  { "menucode": 2, "name": "餐饮订单", "perm_id": 11, SubsMenu: [{ "perm_id": 11, "menueurl": "Order/Index", "menuename": "餐饮订单" }] },
  { "menucode": 2, "name": "团购订单", "perm_id": 13, SubsMenu: [{ "perm_id": 13, "menueurl": "OrderGrouponInfo/Index", "menuename": "团购订单" }] },
  { "menucode": 2, "name": "休闲娱乐订单", "perm_id": 15, SubsMenu: [{ "perm_id": 15, "menueurl": "Order/Index", "menuename": "休闲娱乐订单" }] },
  { "menucode": 2, "name": "会议会宴询问", "perm_id": 16, SubsMenu: [{ "perm_id": 16, "menueurl": "ConferenceRoom/AskList", "menuename": "会议会宴询问" }] },
  { "menucode": 2, "name": "备注预选", "perm_id": 17, SubsMenu: [{ "perm_id": 17, "menueurl": "RemarkPreselection/List", "menuename": "备注预选" }] },
  { "menucode": 2, "name": "二维码收款", "perm_id": 61, SubsMenu: [{ "perm_id": 61, "menueurl": "Receivables/Index", "menuename": "二维码收款" }] },
    //客房中心
    { "menucode": 3, "menuname": "客房中心", },
    { "menucode": 3, "name": "客房促销", "perm_id": 18, SubsMenu: [{ "perm_id": 18, "menueurl": "Promotion/List", "menuename": "客房促销" }] },
  { "menucode": 3, "name": "新闻与优惠", "perm_id": 23, SubsMenu: [{ "perm_id": 23, "menueurl": "NewGraphic/Index", "menuename": "客房促销" }] },
  { "menucode": 3, "name": "优惠券", "perm_id": 8, SubsMenu: [{ "perm_id": 8, "menueurl": "Coupon/List", "menuename": "优惠券" }] },
  { "menucode": 3, "name": "优惠券销售", "perm_id": 58, SubsMenu: [{ "perm_id": 58, "menueurl": "CouponSale/List1", "menuename": "优惠券销售" }] },
  { "menucode": 3, "name": "扫码送优惠券", "perm_id": 58, SubsMenu: [{ "perm_id": 58, "menueurl": "Code/ScanCode", "menuename": "扫码送优惠券" }] },
  { "menucode": 3, "name": "积分兑换记录", "perm_id": 3, SubsMenu: [{ "perm_id": 3, "menueurl": "Gift/Handle", "menuename": "积分兑换记录" }] },
  { "menucode": 3, "name": "兑换礼品维护", "perm_id": 2, SubsMenu: [{ "perm_id": 2, "menueurl": "Gift/GiftLIst", "menuename": "兑换礼品维护" }] },
    //微信
    { "menucode": 4, "menuname": "微信", },
    { "menucode": 4, "name": "微信客服", "perm_id": 24, SubsMenu: [{ "perm_id": 24, "menueurl": "Admin/Index", "menuename": "微信客服" }] },
  { "menucode": 4, "name": "微信粉丝分组", "perm_id": 24, SubsMenu: [{ "perm_id": 24, "menueurl": "CustomGroup/Index", "menuename": "微信粉丝分组" }] },
  { "menucode": 4, "name": "微信二维码", "perm_id": 25, SubsMenu: [{ "perm_id": 25, "menueurl": "Code/Index", "menuename": "微信二维码" }] },
  { "menucode": 4, "name": "微信自动回复", "perm_id": 27, SubsMenu: [{ "perm_id": 27, "menueurl": "KeyForHotel/Index", "menuename": "微信自动回复" }] },
  { "menucode": 4, "name": "微信菜单", "perm_id": 28, SubsMenu: [{ "perm_id": 28, "menueurl": "Menu/Index", "menuename": "微信菜单" }] },
  { "menucode": 4, "name": "微信消息", "perm_id": 29, SubsMenu: [{ "perm_id": 29, "menueurl": "Message/Index", "menuename": "微信消息" }] },
  { "menucode": 4, "name": "微信关注设置", "perm_id": 22, SubsMenu: [{ "perm_id": 22, "menueurl": "FirstConcern/Index", "menuename": "微信关注设置" }] },
    //高级功能
    { "menucode": 5, "menuname": "高级功能", },
    { "menucode": 5, "name": "游戏设置", "perm_id": 30, SubsMenu: [{ "perm_id": 30, "menueurl": "Games/GameNew", "menuename": "游戏设置" }] },
  { "menucode": 5, "name": "微上墙", "perm_id": 31, SubsMenu: [{ "perm_id": 31, "menueurl": "WeChatWall/Index", "menuename": "微上墙" }] },
  { "menucode": 5, "name": "酒店团购", "perm_id": 32, SubsMenu: [{ "perm_id": 32, "menueurl": "HotelGroupon/Index", "menuename": "酒店团购" }] },
  { "menucode": 5, "name": "微请帖", "perm_id": 33, SubsMenu: [{ "perm_id": 33, "menueurl": "WeInvitation/Index", "menuename": "微请帖" }] },
  { "menucode": 5, "name": "投票调查", "perm_id": 19, SubsMenu: [{ "perm_id": 19, "menueurl": "Vote/Index", "menuename": "投票调查" }] },
  { "menucode": 5, "name": "调查问卷", "perm_id": 20, SubsMenu: [{ "perm_id": 20, "menueurl": "Survey/Index", "menuename": "调查问卷" }] },
  { "menucode": 5, "name": "分享", "perm_id": 66, SubsMenu: [{ "perm_id": 66, "menueurl": "Vote/ShareVote", "menuename": "调查问卷" }] },
    //酒店中心
    { "menucode": 6, "menuname": "酒店中心", },
  { "menucode": 6, "name": "酒店信息", "perm_id": 34, SubsMenu: [{ "perm_id": 34, "menueurl": "Hotel/HotelMessage", "menuename": "酒店信息" }] },
  { "menucode": 6, "name": "酒店介绍", "perm_id": 62, SubsMenu: [{ "perm_id": 62, "menueurl": "Hotel/HotelIntroduce", "menuename": "酒店介绍" }] },
  { "menucode": 6, "name": "酒店设施", "perm_id": 41, SubsMenu: [{ "perm_id": 41, "menueurl": "Hotel/HotelFacilities", "menuename": "酒店设施" }] },
  { "menucode": 6, "name": "酒店图片上传", "perm_id": 35, SubsMenu: [{ "perm_id": 35, "menueurl": "HotelImg_Add/Hotel", "menuename": "酒店图片上传" }] },
  { "menucode": 6, "name": "客房信息", "perm_id": 36, SubsMenu: [{ "perm_id": 36, "menueurl": "House/List", "menuename": "客房信息" }] },
  { "menucode": 6, "name": "客房价格日历", "perm_id": 37, SubsMenu: [{ "perm_id": 37, "menueurl": "RoomCalendaPrice/Index", "menuename": "客房价格日历" }] },
  { "menucode": 6, "name": "餐厅信息", "perm_id": 38, SubsMenu: [{ "perm_id": 38, "menueurl": "Restaurant/List", "menuename": "餐厅信息" }] },
  { "menucode": 6, "name": "休闲娱乐", "perm_id": 39, SubsMenu: [{ "perm_id": 39, "menueurl": "Entertainment/List", "menuename": "休闲娱乐" }] },
  { "menucode": 6, "name": "会议宴会", "perm_id": 40, SubsMenu: [{ "perm_id": 40, "menueurl": "ConferenceRoom/List", "menuename": "会议宴会" }] },
  { "menucode": 6, "name": "周边指南", "perm_id": 42, SubsMenu: [{ "perm_id": 42, "menueurl": "HotelRegional/List", "menuename": "周边指南" }] },
  { "menucode": 6, "name": "酒店WiFi", "perm_id": 43, SubsMenu: [{ "perm_id": 43, "menueurl": "WifiManager/Index", "menuename": "酒店WiFi" }] },
  { "menucode": 6, "name": "问答", "perm_id": 6, SubsMenu: [{ "perm_id": 6, "menueurl": "Ask/List", "menuename": "问答" }] },
  { "menucode": 6, "name": "留言板/建议", "perm_id": 7, SubsMenu: [{ "perm_id": 7, "menueurl": "Messages/List", "menuename": "留言板/建议" }] },
    //数据分析
    { "menucode": 7, "menuname": "数据分析", },
    { "menucode": 7, "name": "订单统计分析", "perm_id": 67, SubsMenu: [{ "perm_id": 67, "menueurl": "Report/OrderSummary", "menuename": "订单统计分析" }] },
  { "menucode": 7, "name": "餐饮订单分析", "perm_id": 65, SubsMenu: [{ "perm_id": 65, "menueurl": "Report/RestaurantOrder", "menuename": "餐饮订单分析" }] },
  { "menucode": 7, "name": "订单支付统计", "perm_id": 68, SubsMenu: [{ "perm_id": 68, "menueurl": "Report/OrderPaySummary", "menuename": "订单支付统计" }] },
  { "menucode": 7, "name": "扫码支付统计", "perm_id": 69, SubsMenu: [{ "perm_id": 69, "menueurl": "Report/ScanCodePaySummary", "menuename": "扫码支付统计" }] },
  { "menucode": 7, "name": "现金账户统计", "perm_id": 70, SubsMenu: [{ "perm_id": 70, "menueurl": "Report/CashAccountSummary", "menuename": "现金账户统计" }] },
  { "menucode": 7, "name": "优惠券使用统计", "perm_id": 71, SubsMenu: [{ "perm_id": 71, "menueurl": "Report/CouponUseSummary", "menuename": "优惠券使用统计" }] },
  { "menucode": 7, "name": "积分统计", "perm_id": 72, SubsMenu: [{ "perm_id": 72, "menueurl": "Report/PointsSummary", "menuename": "积分统计" }] },
    //财务对账
    { "menucode": 9, "menuname": "财务对账", },
    { "menucode": 9, "name": "对账单查询", "perm_id": 57, SubsMenu: [{ "perm_id": 57, "menueurl": "PayAccountStateMent/Index", "menuename": "对账单查询" }] },
    //系统设置
    { "menucode": 8, "name": "系统设置", },
    { "menucode": 8, "name": "管理员管理", "perm_id": 51, SubsMenu: [{ "perm_id": 51, "menueurl": "SystemSet/UserManage", "menuename": "管理员管理" }] },
  { "menucode": 8, "name": "密码更改", "perm_id": 52, SubsMenu: [{ "perm_id": 52, "menueurl": "SystemSet/PassWordChange", "menuename": "密码更改" }] },
  { "menucode": 8, "name": "系统通知设置", "perm_id": 53, SubsMenu: [{ "perm_id": 53, "menueurl": "NotifySetting/Index", "menuename": "系统通知设置" }] },
  { "menucode": 8, "name": "订单确认设置", "perm_id": 73, SubsMenu: [{ "perm_id": 73, "menueurl": "OrderConfirm/Index", "menuename": "订单确认设置" }] },
  { "menucode": 8, "name": "酒店常用设置", "perm_id": 54, SubsMenu: [{ "perm_id": 54, "menueurl": "CommonTools/Index", "menuename": "酒店常用设置" }] },
  { "menucode": 8, "name": "积分抵扣", "perm_id": 54, SubsMenu: [{ "perm_id": 54, "menueurl": "PointDiscount/Index", "menuename": "积分抵扣" }] },
  { "menucode": 8, "name": "酒店模板设置", "perm_id": 63, SubsMenu: [{ "perm_id": 63, "menueurl": "SettingHotelTheme/Hotel", "menuename": "酒店模板设置" }] },
  { "menucode": 8, "name": "酒店排序", "perm_id": 64, SubsMenu: [{ "perm_id": 63, "menueurl": "HotelIndex/Index", "menuename": "酒店排序" }] },
  { "menucode": 8, "name": "语音提示", "perm_id": 55, SubsMenu: [{ "perm_id": 63, "menueurl": "VoiceUpLoad/Index", "menuename": "语音提示" }] }
  ]
  var myE = eval(stri);
  $(document).ready(function () {
    Menue('@dealer.clding.com.Utility.LoginInfo.PermIDs');
  });
  function Menue(perids) {
    $.each(myE, function (key, value) {
      $('.dl1').append("<dt class=\"dt1\" style=\"cursor: pointer;\" onclick=\"menuShow(this)\" menucode=\"" + myE[key].menucode + "\"><span>" + myE[key].menuname + "</span><i class=\"i02\"></i></dt>");
      //<dd class=\"dd1\"><a href=" + myE[key].menueurl + ">" + myE[key].menuname + "\"</a></dd>"
      alert(myE[key].menuname);
    });

以上所述就是本文的全部内容了,希望大家能够喜欢。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索json字符串
JSON对象
javascript json对象、javascript对象转json、json字符串转json对象、java对象转json字符串、gson字符串转json对象,以便于您获取更多的相关知识。

时间: 2024-10-03 03:33:09

JSON字符串转JSON对象_javascript技巧的相关文章

JS对象与json字符串格式转换实例_javascript技巧

本文实例讲述了JS对象与json字符串格式转换的实现方法,分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />     <title></title>     <script type="text/javascript"&g

js 将json字符串转换为json对象的方法解析_javascript技巧

例如: JSON字符串: var str1 = '{ "name": "cxh", "sex": "man" }'; JSON对象: var str2 = { "name": "cxh", "sex": "man" }; 一.JSON字符串转换为JSON对象 要使用上面的str1,必须使用下面的方法先转化为JSON对象: //由JSON字符串转换为

Json字符串转换为java对象的各种实现方法【json_lib框架、Gson、org.json】

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://mengzhengbin520.blog.51cto.com/7590564/1283361 JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写.同时也易于机器解析和生成.它基于JavaScript Programming Language, Standard ECMA-262 3rd Edition - Decembe

Java中Json字符串直接转换为对象的方法(包括多层List集合)_java

使用到的类:net.sf.json.JSONObject  使用JSON时,除了要导入JSON网站上面下载的json-lib-2.2-jdk15.jar包之外,还必须有其它几个依赖包:commons-beanutils.jar,commons-httpclient.jar,commons-lang.jar,ezmorph.jar,morph-1.0.1.jar 下面是例子代码: // JSON转换 JSONObject jsonObj = JSONObject.fromObject(jsonSt

Java中JSON字符串与java对象的互换实例详解_java

在开发过程中,经常需要和别的系统交换数据,数据交换的格式有XML.JSON等,JSON作为一个轻量级的数据格式比xml效率要高,XML需要很多的标签,这无疑占据了网络流量,JSON在这方面则做的很好,下面先看下JSON的格式, JSON可以有两种格式,一种是对象格式的,另一种是数组对象, {"name":"JSON","address":"北京市西城区","age":25}//JSON的对象格式的字符串 [

JSON简介以及用法汇总_javascript技巧

JSON(JavaScript Object Notation)即JavaScript对象表示法,是一种轻量级的数据交换格式.它非常便于编程人员对数据的处理,也便于机器对数据的解析和生成,应用非常广泛. JSON是一种轻量级的数据交换格式,某个JSON格式的文件内部譬如可以长成这样: { "name": "hanzichi", "sex": "male" } 看起来都是key-value的键值对,很像js的对象吧?没错,但同时

Jquery解析json字符串及json数组的方法

  本文实例讲述了Jquery解析json字符串及json数组的方法.分享给大家供大家参考.具体如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 6

ajax响应json字符串和json数组的实例(详解)

最近上班太忙,晚上抽空整理一下ajax请求中,后台返回json字符串和json数组的场景,以及前台的处理示例. 直接看代码. json字符串的后台响应 package com.ajax; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.serv

Json字符串转换为JS对象的高效方法实例_javascript技巧

今天学习JQuery源码看到一下方法,原来还可以这样解析JSON字符串: 复制代码 代码如下:   parseJSON: function( data ) {  if ( typeof data !== "string" || !data ) {   return null;  }   // Make sure leading/trailing whitespace is removed (IE can't handle it)  data = jQuery.trim( data );