Skip to content

DocumentModel

SmartJSONEditor edited this page Aug 9, 2017 · 32 revisions

DocumentModel Class

DocumentModel class represents a global application context accessed as "DocumentModel" global variable in script context. DocumentModel let you use Swift JSON Editor application internal helper functions to

  • Retrieve Project Nodes
  • Use helper functions for encoding, logging, timestamp etc.

Functions

Function Parameters Returns Description
log(object) Javascript/String/Number String description Use to print log information about provided objects
rootJsonNode(projectNodeID) String (project node identifier) or nil root JSON node associated with project node as JavascriptJsonNode object returns root json node of project node

Value Transformers Helper functions

Function Parameters Returns Description
randomValueDatabase(key) String String Use to get random value from database. Possible keys are: maleNames,femaleNames,surname,country,countryCode,USState,USStateCode,currencyName,currencyCode,color,loremIpsum
base64Encode(string) String String Encode string using Base64 algorithm

Examples

this.transform = function (inputValue, jsonValue, arrayIndex, parameters, info) {
    var value = DocumentModel.randomValueDatabase("country");
    DocumentModel.log(value);
    return value
}

Clone this wiki locally