Giter Site home page Giter Site logo

json's Introduction

json

CMake

Dependencies:
CMake crypto CMake sync

A JSON parser / serializer written in C.

1 Download

2 Build

3 Example

3.1 Example input

3.2 Example output

4 Tester

5 Definitions

5.1 Type definitions

5.2 Function definitions

5.3 Macro definitions

Download

To download json, execute the following command

$ git clone https://github.com/Jacob-C-Smith/json --recurse-submodules

Build

To build on UNIX like machines, execute the following commands in the same directory

$ cd json
$ cmake .
$ make

This will build the example program, and dynamic / shared libraries

To build json for Windows machines, open the base directory in Visual Studio, and build your desired target(s)

Example

NOTE: If you are running the tester program on Windows, you may have to copy example files to the Debug or Release directories. The example program parses the input file, and writes the parsed tokens to stdout. To run the example program, execute this command.

./json_example file1.json [file2.json ... fileN.json]

Example input

{
   "name"      : "Jacob Smith",
   "age"       : 20,
   "height"    : 1.775,
   "dog"       : {
       "name"  : "Eddie",
       "sex"   : "Male",
       "breed" : "Terrier"
   },
   "interests" : [
       "Computer science",
       "3D modeling",
       "Organic chemistry",
       "Mathematics",
       "Computer games",
       "Epistemology"
   ]
}

example.json

Example output

--- example.json ---
{"name":"Jacob Smith","age":20,"height":1.775,"dog":{"name":"Eddie","sex":"Male","breed":"Terrier"},"interests":["Computer science","3D modeling","Organic chemistry","Mathematics","Computer games","Epistemology"]}

Source

Tester

NOTE: If you are running the tester program on Windows, you may have to copy the serial test cases and parse test cases directories to the Debug or Release directories.

To run the tester program, execute this command after building

$ ./json_test

Source

Tester output

Definitions

Type definitions

typedef struct json_value_s json_value;

Function definitions

// Parse text to json_value
int  parse_json_value ( char *text, char **return_pointer, json_value_t **pp_value );

// Serialize a json_value to text 
int  print_json_value ( json_value *p_value, FILE *f );


void free_json_value  ( json_value *p_value );

json's People

Contributors

jacob-c-smith avatar

Stargazers

 avatar  avatar

Watchers

 avatar

json's Issues

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.