Our documentation has moved!

You are currently viewing a legacy version of our help articles.
For the most up-to-date version, please use the new Chargify Help & Support Site.
Follow

[2013]-01-28] API CHANGE in JSON Decoding

The JSON specification requires that strings be sequences of characters wrapped in double quotes.  For some time, we have parsed JSON data sent to our API that contained strings wrapped in single quotes (') rather than double quotes (") which the spec dictates.

Due to security reasons, we can no longer parse incoming JSON strings wrapped in single quotes, whether they appear as names (i.e. keys) or values.

Please inspect the JSON data you are sending to our API to ensure that all of your strings are properly double quoted.  JSON strings that are single quoted will be considered malformed and will trigger a parse error.  Beginning very soon, parse errors for single quoted strings will return HTTP status code 400 ("Bad Request").

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

5 Comments

  • 0
    Avatar
    Dusty Reagan

    Has this already taken into effect? Sounds like it has the potential to break a lot of implementations. I just happened to notice this update while looking up something else. Perhaps it deserves a larger announcement?

  • 0
    Avatar
    Andrew Diey

    Thanks for the info! I was really getting confused as to why my API calls didn't work.

    I had enclosed the complete json request in double quotes, but not the individual keys and values, which gave me a proper "HTTP 1.1  200 OK" response on the calls, but nothing was ever changed in the data. Then I found this note...

    Perhaps you should think about updating the API examples in your docs, as they are using single quotes. That's where I got it wrong.

    Anyway, thanks for clarifying. All is now well and working perfectly.

    Cheers

    Johan

  • 0
    Avatar
    Michael Klett

    Johan, Glad you got it sorted out!  Would you mind pointing me to where the examples with single quotes are?  I checked parts of the documentation, and the places I looked had the double quotes.  If you can give me a pointer, I'll get it fixed.

    Thanks!

    Michael

  • 0
    Avatar
    Michael Klett

    Dusty, it has taken effect already.  We logged offenders for several days (before and after the announcement) in order to size the impact and help those affected work around it.  Only one site was affected during this time and we worked with them directly on a resolution.  We continue to collect logs on this and have had no other instances of note.

    Thanks, Michael

  • 0
    Avatar
    Andrew Diey

    Hi Michael

    The examples I was looking at were "JSON Delayed Cancel Usage Example" and "JSON Delete/Cancel Usage Example"

    both on the subscriptions API page [ http://docs.chargify.com/api-subscriptions ]

    And, you're right, all the other examples seem to use double quotes. So I guess it was just bad luck that I choose the faulty ones ;)

    Thanks for your swift response. If I see any more single quotes I will let you know.

    Cheers

    Johan

Please sign in to leave a comment.
Powered by Zendesk