How to use the json.stringify function in json

To help you get started, we’ve selected a few json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kissygalleryteam / offline / 2.5.0 / build / index.js View on Github external
_saveToBrowser: function () {
		var flag = true;
		try {
			oIeOffline.setAttribute(TIME_DEADLINE, Json.stringify(oDeadline));
			oIeOffline.setAttribute(SINGLE_KEY, Json.stringify(oGlobal));
			oIeOffline.save(IE_OFFLINE);
		} catch (e) {
			// 磁盘已满或权限不足等问题
			flag = false;
		}
		return flag;
	}
});	//re.init();
github kissyteam / kissy / src / router / demo / mods / sync.js View on Github external
if (index > -1) {
                        store.splice(index, 1);
                    }
                    break;
                case 'update':
                    id = self.get('id');
                    index = findById(store, id);
                    if (index > -1) {
                        store[index] = self.toJSON();
                    }
                    break;
            }

            if (method !== 'read' && window.localStorage) {
                try {
                    window.localStorage.setItem(KEY, Json.stringify(store));
                } catch (e) {
                    // QUOTA_EXCEEDED_ERR
                    S.log(e, 'error');
                }
            }

            STORE = store;

            if (error) {
                if (options.error) {
                    options.error(null, error);
                }
            }

            else if (options.success) {
                options.success(ret);
github kissygalleryteam / offline / 2.5.0 / kissy5.0_code / localstorage.js View on Github external
_saveDeadLine: function () {
		ls.setItem(DEADLINE_KEY, Json.stringify(oDeadline));
	}
});	//re.init();
github kissygalleryteam / offline / 2.5.0 / build / index.js View on Github external
_saveDeadLine: function () {
		ls.setItem(DEADLINE_KEY, Json.stringify(oDeadline));
	}
});	//re.init();
github kissygalleryteam / offline / 2.5.0 / build / ie-offline.js View on Github external
usedByte: function () {
		var tempLen = 0, strDeadLine = Json.stringify(oDeadline);
		//deadline不存在
		if (oDeadline !== '') {
			tempLen += strDeadLine.length + TIME_DEADLINE.length;
		}
		tempLen += Json.stringify(oGlobal).length;
		return tempLen;
	},
	getAll: function (isObject) {
github kissygalleryteam / offline / 2.5.0 / build / index.js View on Github external
usedByte: function () {
		var tempLen = this.getAll().length;
		//统计时间的key有可能还没有
		if (ls[DEADLINE_KEY]) {
			tempLen += Json.stringify(oDeadline).length;
			tempLen += DEADLINE_KEY.length;
		}
		return tempLen;
	},
	/**
github kissygalleryteam / offline / 2.5.0 / build / index.js View on Github external
getAll: function (isObject) {
		var len = ls.length, oTemp = {}, key;
		for (i = 0; i < len; i++) {
			key = ls.key(i);
			oTemp[key] = ls.getItem(key);
			if (key === DEADLINE_KEY) {
				delete oTemp[key];
			}
		}
		if (isObject) {
			return oTemp;
		}
		return Json.stringify(oTemp);
	},
	timeRemain: function (key) {
github kissygalleryteam / offline / 2.5.0 / build / ie-offline.js View on Github external
getAll: function (isObject) {
		if (isObject) {
			return oGlobal;
		}
		return Json.stringify(oGlobal);
	},
	/**
github kissyteam / kissy / build / editor / plugin / draft-debug.js View on Github external
draft = drafts[i];
                tip = (draft.auto ? '\u81EA\u52A8' : '\u624B\u52A8') + '\u4FDD\u5B58\u4E8E : ' + date(draft.date);
                versions.addItem({
                    content: tip,
                    value: i
                });
            }
            if (!drafts.length) {
                versions.addItem({
                    disabled: true,
                    content: '\u5C1A\u65E0\u5386\u53F2',
                    value: ''
                });
            }
            timeTip.html(tip);
            localStorage.setItem(self._getSaveKey(), localStorage === window.localStorage ? encodeURIComponent(Json.stringify(drafts)) : drafts);
        },
        save: function (auto) {
github kissygalleryteam / offline / 2.5.0 / build / index.js View on Github external
usedByte: function () {
		var tempLen = 0, strDeadLine = Json.stringify(oDeadline);
		//deadline不存在
		if (oDeadline !== '') {
			tempLen += strDeadLine.length + TIME_DEADLINE.length;
		}
		tempLen += Json.stringify(oGlobal).length;
		return tempLen;
	},
	getAll: function (isObject) {