Title: REST API Json Encoding
Last modified: April 28, 2017

---

# REST API Json Encoding

 *  [weswitt](https://wordpress.org/support/users/weswitt/)
 * (@weswitt)
 * [9 years ago](https://wordpress.org/support/topic/rest-api-json-encoding/)
 * What are the rules/requirements for encoding of the JSON elements sent via the
   REST API?
 * If I encode the content element when the post is displayed it is not decoded.
 * I am writing code to create new posts using C++ on Linux. I’m encoding the content
   string using curl_easy_escape.
 * For a lot of the text in the content encoding is not necessary, but for some 
   like hrefs it does need to be encoded, but then the WordPress website needs to
   decode the HTML text.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years ago](https://wordpress.org/support/topic/rest-api-json-encoding/#post-9082146)
 * JSON content should comply with [RFC 7159](https://tools.ietf.org/html/rfc7159).
   Are you saying your content is still JSON encoded? If so, did your request include
   the content-type header? The API will assume content is urlencoded if no content
   type is specified.
 * Or is it JSON decoded but still escaped? The JSON encoder should properly escape
   content, you wouldn’t need to do so separately.

Viewing 1 replies (of 1 total)

The topic ‘REST API Json Encoding’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/rest-api-json-encoding/#post-9082146)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
