• 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

    (@bcworkz)

    JSON content should comply with RFC 7159. 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.