Class LoadJson
java.lang.Object
net.sourceforge.plantuml.tim.builtin.SimpleReturnFunction
net.sourceforge.plantuml.tim.builtin.LoadJson
- All Implemented Interfaces:
TFunction
Loads JSON data from file or URL source.
Supports three parameters for datasource, default JSON value and charset. The datasource will be checked against the security rules.
Examples:
@ startuml
' loads a local file
!$JSON_LOCAL_RELATIVE=%load_json("file.json")
' loads a local file from an absolute file path
!$JSON_LOCAL_ABS=%load_json("c:/loaded/data/file.json")
' tries to load a local file and returns an empty JSON
!$JSON_LOCAL_REL_EMPTY=%load_json("file-not-existing.json")
' tries to load a local file and returns an default JSON
!$DEF_JSON={"status":"No data found"}
!$JSON_LOCAL_REL_DEF=%load_json("file-not-existing.json", $DEF_JSON)
' loads a local file with a specific charset (default is UTF-8)
!$JSON_LOCAL_RELATIVE_CHARSET=%load_json("file.json", "{}", "iso-8859-1")
' loads a remote JSON from an endpoint (and default, if not reachable)
!$STATUS_NO_CONNECTION={"status": "No connection"}
!$JSON_REMOTE_DEF=%load_json("https://localhost:7778/management/health", $STATUS_NO_CONNECTION)
status -> $JSON_REMOTE_DEF.status
@ enduml
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecuteReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values, Map<String, TValue> named) Methods inherited from class net.sourceforge.plantuml.tim.builtin.SimpleReturnFunction
executeProcedureInternal, getFunctionType, isUnquoted
-
Constructor Details
-
LoadJson
public LoadJson()
-
-
Method Details
-
getSignature
-
canCover
-
executeReturnFunction
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values, Map<String, TValue> named) throws EaterException- Throws:
EaterException
-