# FromBytes

| **Name**    | ***FromBytes***                                                                                                                                                                           |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | FromBytes (ByteArray bytes. String codePage)                                                                                                                                              |
| Purpose     | To return a string by reading a byte array in a specified encoding.                                                                                                                       |
| Description | Returns a string after it has been converted from a byte array.                                                                                                                           |
| Return Type | String                                                                                                                                                                                    |
| Parameters  | <p>bytes \[System.Byte\[]] – The raw byte array containing a textual value.</p><p>codepage \[System.String] – The code page the byte array is currently encoded in. Default is UTF-8.</p> |

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/cC93aZXWjPpsLs4VJ6F5/0.png)

**Example**

In this example, we are passing the required parameters to the function transformation object using a *Variables* object and a *ToByte* object.

Where,

*bytes =* value

**Note:** The *Value* is the output value (bytes) from the *ToBytes* function transformation object, where a string value, “Hello World”, has been converted into a byte array.

*codepage* = 65001 (UTF-8 - Default)

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/HypUR8mgx3kXsEgchUdZ/1.png)

Right-click on the *FromBytes* function transformation object and select *Preview Output.* You can see that Astera has returned a string value after successfully converting the provided byte array.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/ZuBQ1cSdDOzpbqFXSp0F/2.png)
