≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
working with JSON in coppercube
Posted by:
(you are not logged in)
Enter the missing letter in: "Internation?l"
(you are not logged in)
Text:
[quote][b][/b] wrote: Hi, Coppercube uses pre es-5 version of js, which doesn't have JSON object api yet. You can use a polyfill. The simplest one would be: [code]JSON = { parse: function (sJSON) { return eval('(' + sJSON + ')'); }, stringify: function (vContent) { if (vContent instanceof Object) { var sOutput = ''; if (vContent.constructor === Array) { for (var nId = 0; nId < vContent.length; sOutput += this.stringify(vContent[nId]) + ',', nId++); return '[' + sOutput.substr(0, sOutput.length - 1) + ']'; } if (vContent.toString !== Object.prototype.toString) { return '"' + vContent.toString().replace(/"/g, '\\$&') + '"'; } for (var sProp in vContent) { sOutput += '"' + sProp.replace(/"/g, '\\$&') + '":' + this.stringify(vContent[sProp]) + ','; } return '{' + sOutput.substr(0, sOutput.length - 1) + '}'; } return typeof vContent === 'string' ? '"' + vContent.replace(/"/g, '\\$&') + '"' : String(vContent); } };[/code] You can also google json2 and json3, I believe, these implementations could also be adapted to use in Coppercube, but the one above usually works for me.[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact