markdown guide

Out of curiosity, what's your motivation for learning C? I think that trying something like making HTTP requests and parsing JSON is going to be very frustrating if you're just trying to learn, and depending on what you intend to use it for, may not be something you end up doing in C anyway!


I am trying to build a service that makes post request to an API that provides IVR functionalities and handles the response and manages many things such as retries, call status, etc
Just wanted to try doing some http stuff with C


Any particular reason you want to do this in C rather than a higher-level language (eg. running on an embedded device)? Or just as an exercise to learn C?


Unless you really want to understand the lowest levels of how HTTP requests work or practice your parsing skills by implementing your own JSON parser, I would recommend googling for "HTTP requests in C", "JSON parser in C" or the like - there are plenty of third-party libraries in C which do the heavy lifting for you. For example:


I use CURL and cJSON for these issues.

You can see some examples for GET and POST requests in this parser program. You would be interested in get_weather() (and its two parser functions) and get_portfolio_value()/parse_portfolio_json() for GET requests and parsing the jsons and get_token() as an example of a POST request.



I've never tried it, but this framework looks interesting: kore.io/

Here's an example using yajl to parse JSON:



"piGroup":" ",
"nonSerializedScanData": [],
"serializedScanData": [],
"piType": "MINI",
"isLastUser": true,
"sessionId": ""

Classic DEV Post from May 4 '18

What I'd like to hear from an experienced developer when I was a beginner

We have to make a lot of personal and professional decisions during life. In this post, I will help students to make them.

Ashok Mohanakumar profile image
INTP | Full Stack Dev