> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/troubleshooting-and-resources/armory/general/spring-expression-language-tricks.md).

# Spring Expression Language Tricks

### Introduction <a href="#introduction" id="introduction"></a>

Spinnaker uses the Spring Expression Language (SpEL) for pipeline expressions, so you can do a lot of interesting things with Spinnaker expressions. Here are a couple of the more interesting examples that we’ve come across (this page will grow)

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

N/A

### Instructions <a href="#instructions" id="instructions"></a>

Basic Math Take the number of instances for a deployment and multiply by a non-integer value:Note: “Get Deployment” is the name of the “Find Artifacts from Resource (Manifest)” stage that looks at a Kubernetes deployment object. `${ (0.8 * #stage("Get Deployment")["outputs"]["manifest"]["spec"]["replicas"]).intValue() }` Helper Properties Create a `parameter environment` with 3 options Access the value of the variable via a helper property, in this case, `parameter`. For example: `The environment is: ${ parameters.environment }` Some Helper Properties are already defined, for example: `The execution id is automatically set: ${execution['id']}` Helper Functions Read and print a JSON, for example: `${#readJson('{"development": "dev", "staging": "stage", "production":"prod"}').toString()}` You can also access a value in the JSON with the `environment` parameter from the [Helper Properties](https://kb.armory.io/pipelines/spel-tricks/#helper_properties) Section: `${#readJson('{"development": "dev", "staging": "stage", "production":"prod"}')[parameters.environment]}` Ternary Operator `? :` Simple example: `${ true ? "True text" : "False text" }` Example (in the text of a Manual Judgement stage), where `Get Service` is a “Find Artifacts From Resource (Manifest)” that looks at a Kubernetes `service` object: `The loadBalancer ingress is ${ #stage("Get Service")["outputs"]["manifest"]["status"]["loadBalancer"].containsKey("ingress") ? "ready" : "not ready" }.` Whitelisted Java Classes Some Java classes are available for use in SpEL expressions (see [Spinnaker Reference Docs](https://www.spinnaker.io/reference/pipeline/expressions/#whitelisted-java-classes))For example, generating the current date in MM-dd-yyyy format: `${new java.text.SimpleDateFormat("MM-dd-yyyy").format(new java.util.Date())}` Sometimes you may want to call a static method. For example, to generate a UUID: `${T(java.util.UUID).randomUUID() }`
