當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript JSON.serialize函數代碼示例

本文整理匯總了TypeScript中tinymce/core/api/util/JSON.serialize函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript serialize函數的具體用法?TypeScript serialize怎麽用?TypeScript serialize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了serialize函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  suite.test('serialize', function () {
    LegacyUnit.equal(
      Json.serialize({
        arr1: [1, 2, 3, [1, 2, 3]],
        bool1: true,
        float1: 3.14,
        int1: 123,
        null1: null,
        obj1: { key1: 'val1', key2: 'val2' }, str1: '\"\'abc\u00C5123\\'
      }
      ),
      '{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,' +
      '"obj1":{"key1":"val1","key2":"val2"},"str1":"\\"\'abc\\u00c5123\\\\"}'
    );

    LegacyUnit.equal(
      Json.serialize({
        arr1: [1, 2, 3, [1, 2, 3]],
        bool1: true,
        float1: 3.14,
        int1: 123,
        null1: null,
        obj1: { key1: 'val1', key2: 'val2' }, str1: '\"\'abc\u00C5123'
      }, '\''
      ),
      '{\'arr1\':[1,2,3,[1,2,3]],\'bool1\':true,\'float1\':3.14,\'int1\':123,\'null1\':null,' +
      '\'obj1\':{\'key1\':\'val1\',\'key2\':\'val2\'},\'str1\':\'\\"\\\'abc\\u00c5123\'}'
    );
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:29,代碼來源:JsonTest.ts

示例2: function

 suite.test('serialize', function () {
   LegacyUnit.equal(
     JSON.serialize({
       'arr1': [1, 2, 3, [1, 2, 3]],
       'bool1': true,
       'float1': 3.14,
       'int1': 123,
       'null1': null,
       'obj1': { key1: 'val1', key2: 'val2' },
       '\"obj2': { key1: undefined },
       'str1': '\"\'abc\u00C5123\\',
       'date1': new Date(0)
     }
     ),
     '{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,' +
     '"obj1":{"key1":"val1","key2":"val2"},"\\"obj2":{},"str1":"\\"\'abc\\u00c5123\\\\",' +
     '"date1":"1970-01-01T00:00:00.000Z"}'
   );
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:19,代碼來源:JsonTest.ts

示例3: function

 suite.test('mceInsertRawHTML - insert char at char surrounded by spaces', function (editor) {
   editor.setContent('<p>a b c</p>');
   LegacyUnit.setSelection(editor, 'p', 2, 'p', 3);
   editor.execCommand('mceInsertRawHTML', false, '<strong>X</strong>');
   LegacyUnit.equal(JSON.serialize(editor.getContent()), '"<p>a <strong>X</strong> c</p>"');
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:6,代碼來源:InsertContentCommandTest.ts


注:本文中的tinymce/core/api/util/JSON.serialize函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。