Class JsonPath
Extract a field from the State Machine data or context that gets passed around between states.
Inheritance
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.AWS.StepFunctions.dll
Syntax (csharp)
public class JsonPath : DeputyBase
Syntax (vb)
Public Class JsonPath
Inherits DeputyBase
Remarks
See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html
ExampleMetadata: infused
Examples
Function fn;
new LambdaInvoke(this, "Invoke Handler", new LambdaInvokeProps {
LambdaFunction = fn,
ResultSelector = new Dictionary<string, object> {
{ "lambdaOutput", JsonPath.StringAt("$.Payload") },
{ "invokeRequestId", JsonPath.StringAt("$.SdkResponseMetadata.RequestId") },
{ "staticValue", new Dictionary<string, string> {
{ "foo", "bar" }
} },
{ "stateName", JsonPath.StringAt("$.State.Name") }
}
});
Synopsis
Constructors
JsonPath(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
JsonPath(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
DISCARD | Special string value to discard state input, output or result. |
EntireContext | Use the entire context data structure. |
EntirePayload | Use the entire data structure. |
TaskToken | Return the Task Token field. |
Methods
Array(String[]) | Make an intrinsic States.Array expression. |
Format(String, String[]) | Make an intrinsic States.Format expression. |
IsEncodedJsonPath(String) | Determines if the indicated string is an encoded JSON path. |
JsonToString(Object) | Make an intrinsic States.JsonToString expression. |
ListAt(String) | Instead of using a literal string list, get the value from a JSON path. |
NumberAt(String) | Instead of using a literal number, get the value from a JSON path. |
ObjectAt(String) | Reference a complete (complex) object in a JSON path location. |
StringAt(String) | Instead of using a literal string, get the value from a JSON path. |
StringToJson(String) | Make an intrinsic States.StringToJson expression. |
Constructors
JsonPath(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected JsonPath(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
JsonPath(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected JsonPath(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
DISCARD
Special string value to discard state input, output or result.
public static string DISCARD { get; }
Property Value
System.String
EntireContext
Use the entire context data structure.
public static string EntireContext { get; }
Property Value
System.String
Remarks
Will be an object at invocation time, but is represented in the CDK application as a string.
EntirePayload
Use the entire data structure.
public static string EntirePayload { get; }
Property Value
System.String
Remarks
Will be an object at invocation time, but is represented in the CDK application as a string.
TaskToken
Return the Task Token field.
public static string TaskToken { get; }
Property Value
System.String
Remarks
External actions will need this token to report step completion
back to StepFunctions using the SendTaskSuccess
or SendTaskFailure
calls.
Methods
Array(String[])
Make an intrinsic States.Array expression.
public static string Array(params string[] values)
Parameters
- values System.String[]
Returns
System.String
Remarks
Combine any number of string literals or JsonPath expressions into an array.
Use this function if the value of an array element directly has to come from a JSON Path expression (either the State object or the Context object).
If the array contains object literals whose values come from a JSON path expression, you do not need to use this function.
See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
Format(String, String[])
Make an intrinsic States.Format expression.
public static string Format(string formatString, params string[] values)
Parameters
- formatString System.String
- values System.String[]
Returns
System.String
Remarks
This can be used to embed JSON Path variables inside a format string.
For example:
JsonPath.Format("Hello, my name is {}.", JsonPath.StringAt("$.name"));
See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
IsEncodedJsonPath(String)
Determines if the indicated string is an encoded JSON path.
public static bool IsEncodedJsonPath(string value)
Parameters
- value System.String
string to be evaluated.
Returns
System.Boolean
JsonToString(Object)
Make an intrinsic States.JsonToString expression.
public static string JsonToString(object value)
Parameters
- value System.Object
Returns
System.String
Remarks
During the execution of the Step Functions state machine, encode the given object into a JSON string.
For example:
JsonPath.JsonToString(JsonPath.ObjectAt("$.someObject"));
See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
ListAt(String)
Instead of using a literal string list, get the value from a JSON path.
public static string[] ListAt(string path)
Parameters
- path System.String
Returns
System.String[]
NumberAt(String)
Instead of using a literal number, get the value from a JSON path.
public static double NumberAt(string path)
Parameters
- path System.String
Returns
System.Double
ObjectAt(String)
Reference a complete (complex) object in a JSON path location.
public static IResolvable ObjectAt(string path)
Parameters
- path System.String
Returns
StringAt(String)
Instead of using a literal string, get the value from a JSON path.
public static string StringAt(string path)
Parameters
- path System.String
Returns
System.String
StringToJson(String)
Make an intrinsic States.StringToJson expression.
public static IResolvable StringToJson(string jsonString)
Parameters
- jsonString System.String
Returns
Remarks
During the execution of the Step Functions state machine, parse the given argument as JSON into its object form.
For example:
JsonPath.StringToJson(JsonPath.StringAt("$.someJsonBody"));
See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html