Chargify doesn't support CORS currently (no direct cross domain access), so you'll need to use a proxy (server code) if you want to be able to access the API (through the proxy) via JavaScript. The proxy would be where you would use cURL (or any of the existing API wrapping...
You current problem How to convert chargify webhooks to json with c#? can be generalized to How to extract key value pairs from a string, convert them into the corresponding hierarchy and return them in JSON? To answer your question: string rawData =...