GithubHelp home page GithubHelp logo

skyformat99 / json_lib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ffroehling/json_lib

0.0 2.0 0.0 15 KB

A simple and portable JSON-Parser written in C

License: MIT License

Makefile 0.71% C 99.29%

json_lib's Introduction

json_lib

A simple and portable JSON-Parser written in C

Description

This is a simple JSON-Parser written in C. I wrote this because i needed a simple parser without dependencies on a MC. Feel free to use it for anything u want.

Advantages

  • Simple to use (just a few lines of code)
  • No additional dependencies
  • Portable

Disadvantages (Work to do)

  • No true/false supported yet (as i didn't need it till now) - i will include this asap
  • Not optimized for anything
  • Just basic tests yet
  • Access to values isn't perfect yet (as many checks to NULL). Best to write some wrappers for this
  • No code comments yet.

Feel free to improve anything you want.

Usage:

You need to add the files in json directory to your project. You also need to include the header file "json.h"

The file example.c provides a description of the usage of the library. In general it is really simple. One give in a json-string and two pointers to JSON_OBJECT* and JSON_ARRAY* and then can iterate over these objects.

A JSON_OBJECT consists of a list of Key-Value-Pairs whereas a JSON_ARRAY consists of a list of JSON_OBJECT. You can see an explanation and short code examples in example.c

Be aware: The file example.c DOES NOT work even if it compiles. It will result in a coredump. This is for simplicity reasons. I wanted to keep the example as simple as possible, but still providing all necessary information and therefore just included the code-examples without additional checks or sth like that. If u wonder why there is a coredump: It is because there is an iteration over the json_arr which in fact is NULL (due to an object as input).

Author

Felix Froehling [email protected]

json_lib's People

Contributors

ffroehling avatar

Watchers

skyformat99 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.