public class LoadJson extends SimpleReturnFunction
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 and Description |
---|
LoadJson() |
Modifier and Type | Method and Description |
---|---|
boolean |
canCover(int nbArg,
java.util.Set<java.lang.String> namedArgument) |
TValue |
executeReturnFunction(TContext context,
TMemory memory,
LineLocation location,
java.util.List<TValue> values,
java.util.Map<java.lang.String,TValue> named) |
TFunctionSignature |
getSignature() |
executeProcedure, executeProcedureInternal, getFunctionType, isUnquoted
public TFunctionSignature getSignature()
public boolean canCover(int nbArg, java.util.Set<java.lang.String> namedArgument)
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
EaterException
EaterExceptionLocated