Skip to main content

JSON/jQuery formatting for People create?

Hello and apologies for the noob question. Using jQuery for API calls and I just can't seem to make a request that contains acceptable JSON data for the api. Using something like this:

var rq = $.ajax({
method: "POST",
url: "https://[...][...]",
accepts: "application/json",
contentType: "application/json",
data: JSON.stringify(
{ person: {
email: "[email protected]",
last_name: "Smith",
first_name: "Bob",
sex: "M",
signup_type: 0,
employer: "Dexter Labs",
party: "P"
} }

Return message is always "I can only talk JSON..."

Official response from

Hi Jedd,

I would suggest using an online tool such as the JSON Formatter/Validator, which gave some helpful prompts to adjust the request above to the following raw JSON:

      "email":"[email protected]",
      "employer":"Dexter Labs",

It may also be helpful to consult the docs for the JSON.stringify method you're using for how that is transforming the data you're sending it.

Hope this helps, and happy coding!

Share this post

Showing 2 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.