> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Converting String Type Value to Long Type

> You can convert string type values to Long type. This page includes an example of converting null, empty string and valid string values to Long type.

**Input Values**

```
input null: { "LONG_VALUE_IN_STRING" : null }
input empty string "": { "LONG_VALUE_IN_STRING" : "" }
input string "123": { "LONG_VALUE_IN_STRING" : "123" }
```

**JOLT Transformation Code**

<Tip>
  This example converts null and empty string values to 0, and valid string values to Long type.
</Tip>

```json theme={null}
[
  {
    "operation": "shift",
    "spec": {
      "LONG_VALUE_IN_STRING": {
        "": null,
        " ": null,
        "*": {
          "$": "LONG_VALUE_IN_STRING"
        }
      }
    }
  },
  {
    "operation": "default",
    "spec": {
      "LONG_VALUE_IN_STRING": 0
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "LONG_VALUE_IN_STRING": "=toLong"
    }
  },
  {
    "operation": "shift",
    "spec": {
      "LONG_VALUE_IN_STRING": "value"
    }
  }
]
```

**Output Values**

```
{ "value": 0 }
{ "value": 0 }
{ "value": 123 }
```
