# QueryLanguage

The name of the query language used by the state machine or state.

- Source: [`aws-stepfunctions/lib/types.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-stepfunctions/lib/types.ts#L279)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
const jsonata = sfn.Pass.jsonata(this, 'JSONata');
const jsonPath = sfn.Pass.jsonPath(this, 'JSONPath');
const definition = jsonata.next(jsonPath);

new sfn.StateMachine(this, 'MixedStateMachine', {
  // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
new sfn.StateMachine(this, 'JSONataOnlyStateMachine', {
  queryLanguage: sfn.QueryLanguage.JSONATA,
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});
```

Python:

```python
jsonata = sfn.Pass.jsonata(self, "JSONata")
json_path = sfn.Pass.json_path(self, "JSONPath")
definition = jsonata.next(json_path)

sfn.StateMachine(self, "MixedStateMachine",
    # queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
    definition_body=sfn.DefinitionBody.from_chainable(definition)
)

# This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
sfn.StateMachine(self, "JSONataOnlyStateMachine",
    query_language=sfn.QueryLanguage.JSONATA,
    definition_body=sfn.DefinitionBody.from_chainable(definition)
)
```

Java:

```java
Pass jsonata = Pass.jsonata(this, "JSONata");
Pass jsonPath = Pass.jsonPath(this, "JSONPath");
Chain definition = jsonata.next(jsonPath);

StateMachine.Builder.create(this, "MixedStateMachine")
        // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
        .definitionBody(DefinitionBody.fromChainable(definition))
        .build();

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
StateMachine.Builder.create(this, "JSONataOnlyStateMachine")
        .queryLanguage(QueryLanguage.JSONATA)
        .definitionBody(DefinitionBody.fromChainable(definition))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var jsonata = Pass.Jsonata(this, "JSONata");
var jsonPath = Pass.JsonPath(this, "JSONPath");
var definition = jsonata.Next(jsonPath);

new StateMachine(this, "MixedStateMachine", new StateMachineProps {
    // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
    DefinitionBody = DefinitionBody.FromChainable(definition)
});

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
new StateMachine(this, "JSONataOnlyStateMachine", new StateMachineProps {
    QueryLanguage = QueryLanguage.JSONATA,
    DefinitionBody = DefinitionBody.FromChainable(definition)
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
jsonata := sfn.Pass_Jsonata(this, jsii.String("JSONata"))
jsonPath := sfn.Pass_JsonPath(this, jsii.String("JSONPath"))
definition := jsonata.Next(jsonPath)

sfn.NewStateMachine(this, jsii.String("MixedStateMachine"), &StateMachineProps{
	// queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
	DefinitionBody: sfn.DefinitionBody_FromChainable(definition),
})

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
sfn.NewStateMachine(this, jsii.String("JSONataOnlyStateMachine"), &StateMachineProps{
	QueryLanguage: sfn.QueryLanguage_JSONATA,
	DefinitionBody: sfn.DefinitionBody_*FromChainable(definition),
})
```

## Members

| Member | Description |
| --- | --- |
| `JSON_PATH` | Use JSONPath. |
| `JSONATA` | Use JSONata. |

## Referenced by

- [`State`](/v2/docs/aws-cdk-lib.aws_stepfunctions.State).queryLanguage
- [`StateBaseProps`](/v2/docs/aws-cdk-lib.aws_stepfunctions.StateBaseProps).queryLanguage
- [`StateMachineProps`](/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachineProps).queryLanguage
