---
schema_version: "1"
id: de3e02bef908385651dc3c965dea20e839dee5e1f815222c3ad388c602c5b2ae
title: GetPostData
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformHTTPPropertyGetPostData.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformHTTPPropertyGetPostData.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 52a75ffc2e45b5d540751b30d510597650bc4326cc45177b16669743d1e08202
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# GetPostData

## Overview

Returns the data from the POST payload sent to the requested resource as a string, converted using the provided optional encoding parameter. A common use case is processing JSON payloads supplied to a page. For accessing data sent via a form POST request, use: Platform.Request.GetFormField(fieldName).

### Syntax

GetPostData(1)

### Function Properties

<!--complex table-->

| Ordinal | Type   |     | Description                                                                                |
| ------- | ------ | --- | ------------------------------------------------------------------------------------------ |
| **1**   | string |     | Encoding format. If no value is entered, the encoding format will default to Windows-1252. |

## Encoding

```
jsonPost = Platform.Request.GetPostData();
```

The example above defaults to Windows-1252 encoding.

If the incoming request uses a different encoding format, such as UTF-8, the encoding can be provided using the optional parameter, shown in the example below.

```
jsonPost = Platform.Request.GetPostData('utf-8');
```

## Examples

The examples below assign the JSON data posted to the page to the “json” variable, converting it to a JS object.

Example using Microsoft Windows-1252 encoding (default):

```
<script runat="server" language="JavaScript">
// load data in as a string
   var jsonpost = Platform.Request.GetPostData();
// convert the string to an object
   var json = Platform.Function.ParseJSON(jsonpost);
</script>
```

Example using UTF-8 encoding:

```
<script runat="server" language="JavaScript">
   var jsonpost = Platform.Request.GetPostData('utf-8');
   var json = Platform.Function.ParseJSON(jsonpost);
</script>
```
