lucee.Component
commandbox.system.services.JSONService
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I am a collection of shared functionality for dealing with JSON files
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
Consolelogger
|
true
|
false
|
|
any
|
configService
|
true
|
false
|
|
any
|
fileSystemUtil
|
true
|
false
|
|
any
|
formatterUtil
|
true
|
false
|
|
any
|
jmespath
|
true
|
false
|
|
any
|
logger
|
true
|
false
|
|
any
|
parser
|
true
|
false
|
|
any
|
print
|
true
|
false
|
|
| Constructor Summary | |
|---|---|
|
init()
Constructor. |
|
| Method Summary | |
|---|---|
any
|
addProp([any props], [any prop], [any safeProp], [any targetStruct])
|
boolean
|
check(any JSON, string property)
I check for the existence of a property. |
any
|
clear(any JSON, string property)
I clear a property from a deserialized JSON object. |
private any
|
findArrays(string property)
|
any
|
getANSIColors()
Get ANSI colors for formatting JSON. |
string
|
getConfigService()
|
string
|
getConsolelogger()
|
string
|
getFileSystemUtil()
|
string
|
getFormatterUtil()
|
string
|
getJmespath()
|
string
|
getLogger()
|
string
|
getParser()
|
string
|
getPrint()
|
any
|
isSortedJSON(any json, string sortKeys)
I check to see if a JSON object has sorted keys. |
any
|
mergeData([any target], [any source])
Merges data from source into target. |
any
|
set(any JSON, struct properties, boolean thisAppend)
I set a property from a deserialized JSON object and returns an array of messages regarding the word that was done. |
any
|
setConfigService(any configService)
|
any
|
setConsolelogger(any Consolelogger)
|
any
|
setFileSystemUtil(any fileSystemUtil)
|
any
|
setFormatterUtil(any formatterUtil)
|
any
|
setJmespath(any jmespath)
|
any
|
setLogger(any logger)
|
any
|
setParser(any parser)
|
any
|
setPrint(any print)
|
any
|
show(any JSON, string property, [any defaultValue])
I get a property from a deserialized JSON object and return it. |
any
|
showJMES(any JSON, string property, [any defaultValue])
I get a property from a deserialized JSON object and return it using JMESPath. |
private any
|
toBracketNotation(any property)
|
private any
|
toJMESNotation([any str])
|
any
|
tokenizeProp(string str)
|
any
|
writeJSONFile(string path, any json, [boolean locking='false'])
I write JSON objects to disk after pretty printing them. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
Constructor
| Property Detail |
|---|
access - publicrequired - falsereturntype - anyinject - logbox:logger:consoleserializable - trueaccess - publicrequired - falsereturntype - anyinject - ConfigServiceserializable - trueaccess - publicrequired - falsereturntype - anyinject - FileSystemserializable - trueaccess - publicrequired - falsereturntype - anyinject - Formatterserializable - trueaccess - publicrequired - falsereturntype - anyinject - jmespathserializable - trueaccess - publicrequired - falsereturntype - anyinject - logbox:logger:{this}serializable - trueaccess - publicrequired - falsereturntype - anyinject - parserserializable - trueaccess - publicrequired - falsereturntype - anyinject - printserializable - true| Method Detail |
|---|
propspropsafeProptargetStructI check for the existence of a property
JSONpropertyI clear a property from a deserialized JSON object.
JSONpropertypropertyGet ANSI colors for formatting JSON. Returns defaults if no settings are present
I check to see if a JSON object has sorted keys. (I also work for CFML objects that can be serialized to JSON.)
json - A string containing JSON, or a complex value that can be serialized to JSONsortKeys - The type of key sorting to check for - i.e. "text" or "textnocase"Merges data from source into target
targetsourceI set a property from a deserialized JSON object and returns an array of messages regarding the word that was done.
JSONpropertiesthisAppendconfigServiceConsoleloggerfileSystemUtilformatterUtiljmespathloggerparserprintI get a property from a deserialized JSON object and return it
JSONpropertydefaultValueI get a property from a deserialized JSON object and return it using JMESPath
JSONpropertydefaultValuepropertystrstrI write JSON objects to disk after pretty printing them. (I also work for CFML objects that can be serialized to JSON.)
path - The file path to write tojson - A string containing JSON, or a complex value that can be serialized to JSONlocking - Set to true to have file system access wrapped in a lock