如何在javascript

时间:2018-10-18 18:07:48

标签: javascript json

我想在每个换行符上添加'\ n'。可以使用reg表达来实现

 {
  "name": " ",
  "type": "column",
  "axis": "vertical",
  "content_type": "stack_view",
  "contents": [
    {
      "name": "",
      "type": "row",
      "axis": "horizontal",
      "content_type": "field",
      "contents": [],
      "isParentBlock": false,
      "weight": 100
    }
  ],
  "isParentBlock": true,
  "weight": 100
}

PS-我想实现以下目标。

{\ r \ n \“名称\”:\“ FormStack \”,\ r \ n \“类型\”:\“行\”,\ r \ n \“轴\”:\“水平\ “,\ r \ n \” content_type \“:\”堆栈视图\“,\ r \ n \”内容\“:[\ r \ n {\ r \ n \”名称\“:\” \“,\ r \ n \“ type \”:\“列\”,\ r \ n \“轴\”:\“垂直\”,\ r \ n \“ content_type \”:\“堆栈视图\”,\ r \ n \“内容\”:[\ r \ n {\ r \ n \“名称\”:\“ \”,\ r \ n \“类型\”:\“行\”,\ r \ n \“ axis \“:\” horizo​​ntal \“,\ r \ n \” content_type \“:\” field \“,\ r \ n \” contents \“:[\ r \ n [\ r \ n {\ r \ n \“标题\”:\“签名\”,\ r \ n \“值\”:\“ \”,\ r \ n \“可选\”:\“ \”,\ r \ n \“类型\“:\” signature_stack \“,\ r \ n \” identifier \“:\” \“,\ r \ n \” values \“:[],\ r \ n \” properties \“:{\ r \ n \“强制性\”:\“ \”,\ r \ n \“规则\”:\“ \” \ r \ n},\ r \ n \“按钮\”:[],\ r \ n \“重量\”:50,\ r \ n \“ wrap \”:否,\ r \ n \“ $$ hashKey \”:\“对象:137 \” \ r \ n} \ r \ n],\ r \ n [\ r \ n {\ r \ n \“标题\”:\“输入标题\”,\ r \ n \“值\”:\“ \”,\ r \ n \“可选\”:\“ \”,\ r \ n \ “ type \”:\“ text_view \”,\ r \ n \“ identifier \”:\“ \”,\ r \ n \“ values \”:[],\ r \ n \“ properties \”:{ \ r \ n \“强制性\”:\“ \”,\ r \ n \“规则\”:\“ \” \ r \ n},\ r \ n \“按钮\”:[],\ r \ n \“ weight \”:50,\ r \ n \“ wrap \”:否,\ r \ n \“ $$ hashKey \”:\“对象:151 \” \ r \ n} \ r \ n ] \ r \ n],\ r \ n \“ isParentBlock \”:否,\ r \ n \“重量\”:50 \ r \ n},\ r \ n {\ r \ n \“ name \” :\“ \”,\ r \ n \“类型\”:\“行\”,\ r \ n \“轴\”:\“水平\”,\ r \ n \“ content_type \”:\“ field \“,\ r \ n \”内容\“:[ ],\ r \ n \“ isParentBlock \”:否,\ r \ n \“ weight \”:50 \ r \ n} \ r \ n],\ r \ n \“ isParentBlock \”:是,\ r \ n \“ weight \”:100 \ r \ n} \ r \ n],\ r \ n \“ isParentBlock \”:是,\ r \ n \“ weight \”:100 \ r \ n}

0 个答案:

没有答案