Class LoadJson
java.lang.Object
net.sourceforge.plantuml.tim.stdlib.SimpleReturnFunction
net.sourceforge.plantuml.tim.stdlib.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=%loadJSON("file.json") ' loads a local file from an absolute file path !$JSON_LOCAL_ABS=%loadJSON("c:/loaded/data/file.json") ' tries to load a local file and returns an empty JSON !$JSON_LOCAL_REL_EMPTY=%loadJSON("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=%loadJSON("file-not-existing.json", $DEF_JSON) ' loads a local file with a specific charset (default is UTF-8) !$JSON_LOCAL_RELATIVE_CHARSET=%loadJSON("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=%loadJSON("https://localhost:7778/management/health", $STATUS_NO_CONNECTION) status -> $JSON_REMOTE_DEF.status @ enduml
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCover
(int nbArg, java.util.Set<java.lang.String> namedArgument) executeReturnFunction
(TContext context, TMemory memory, LineLocation location, java.util.List<TValue> values, java.util.Map<java.lang.String, TValue> named) Methods inherited from class net.sourceforge.plantuml.tim.stdlib.SimpleReturnFunction
executeProcedure, executeProcedureInternal, getFunctionType, isUnquoted
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LoadJson
public LoadJson()
-
-
Method Details
-
getSignature
-
canCover
public boolean canCover(int nbArg, java.util.Set<java.lang.String> namedArgument) -
executeReturnFunction
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, java.util.List<TValue> values, java.util.Map<java.lang.String, TValue> named) throws EaterException, EaterExceptionLocated- Throws:
EaterException
EaterExceptionLocated
-