JSON to C (cJSON) Converter

Convert JSON to C structs compatible with cJSON parsing libraries, including nested objects and arrays.

How to use

  1. Paste JSON input from your API payload or sample document.
  2. Select your output target and model options.
  3. Generate, review, and copy the result.

Benefits

  • Handles nested objects and arrays from API responses.
  • Reduces manual model writing and naming inconsistencies.
  • Works instantly in browser with copy-ready output.

Sample JSON

{
  "id": 101,
  "name": "Ada Lovelace",
  "active": true,
  "roles": ["admin", "editor"],
  "profile": {
    "email": "ada@example.com",
    "score": 9.8
  }
}

Sample output

typedef struct {
  int id;
  char *name;
  bool active;
} UserModel;

FAQ

Can I generate nested models from JSON?

Yes. The generator supports nested objects and arrays and outputs corresponding nested model definitions.

Can I force generated fields to optional?

Yes. Use the Force Optional toggle in the app toolbar when you need optional fields in the generated output.