Repository navigation
DocumentModel
SmartJSONEditor edited this page Jan 21, 2019
·
32 revisions
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.
this.transform = function (inputValue, jsonValue, arrayIndex, parameters, info) {
var value = DocumentModel.randomValueDatabase("country");
DocumentModel.log(value);
return value
}| Function | Description |
|---|---|
| log | Use to print log information about provided objects, prints to console. |
| error | Opens console window and prints passed error text. |
| Function | Description |
|---|---|
| getUserParameterValue | Retrive custom stored parameter value |
| setUserParameterValue | Store custom parameter value |
| removeUserParameterValue | Clean up and remove user stored parameter value |
| 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 |
| unixTimestamp() | None | Double | Returns the definition of swift Date() timestamp from 1970 |
| dateTimeString(format,double) | String,Double | String | use to convert timestamp double value with DateFormatter format |
| Function | Parameters | Returns | Description |
|---|---|---|---|
| jsonPath(projectNodeId, jsonPath, javascriptContainers) | String, String, Bool | String | Get JsonPath value for projectNode via projectID and jsonPath defined string. Set true to return |
| base64Encode(string) | String | String | Encode string using Base64 algorithm |
| unixTimestamp() | None | Double | Returns the definition of swift Date() timestamp from 1970 |
| dateTimeString(format,double) | String,Double | String | use to convert timestamp double value with DateFormatter format |