All Projects → scottcgi → Mojojson

scottcgi / Mojojson

Licence: mit
A simple and fast JSON parser.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mojojson

Dictfier
Python library to convert/serialize class instances(Objects) both flat and nested into a dictionary data structure. It's very useful in converting Python Objects into JSON format
Stars: ✭ 67 (-75.28%)
Mutual labels:  json-api, json, json-parser
Datoji
A tiny JSON storage service. Create, Read, Update, Delete and Search JSON data.
Stars: ✭ 222 (-18.08%)
Mutual labels:  json-api, json
Jsonapi Rb
Efficiently produce and consume JSON API documents.
Stars: ✭ 219 (-19.19%)
Mutual labels:  json-api, json
Spine
A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
Stars: ✭ 267 (-1.48%)
Mutual labels:  json-api, json
Json Api Client
A PHP package for mapping remote {json:api} resources to Eloquent like models and collections.
Stars: ✭ 159 (-41.33%)
Mutual labels:  json-api, json
Json Api
Implementation of JSON API in PHP 7
Stars: ✭ 171 (-36.9%)
Mutual labels:  json-api, json
Jsonapi Rails
Rails gem for fast jsonapi-compliant APIs.
Stars: ✭ 242 (-10.7%)
Mutual labels:  json-api, json
Yii2 Json Api
Implementation of JSON API specification for the Yii framework
Stars: ✭ 139 (-48.71%)
Mutual labels:  json-api, json
format-to-json
An algorithm that can format a string to json-like template. 字符串JSON格式化的算法。
Stars: ✭ 30 (-88.93%)
Mutual labels:  json-api, json-parser
JSONinSV
JSON lib in Systemverilog
Stars: ✭ 25 (-90.77%)
Mutual labels:  json-api, json-parser
whc-json-to-class
javascript版本json自动转换生成对应语言模型类The whc-json-to-class is the javascript plug-in that automatically converts the json string to the corresponding language model class
Stars: ✭ 24 (-91.14%)
Mutual labels:  json-api, json-parser
Coloquent
Javascript/Typescript library mapping objects and their interrelations to JSON API, with a clean, fluent ActiveRecord-like (e.g. similar to Laravel's Eloquent) syntax for creating, retrieving, updating and deleting model objects.
Stars: ✭ 149 (-45.02%)
Mutual labels:  json-api, json
Weld
Full fake REST API generator written with Rust
Stars: ✭ 146 (-46.13%)
Mutual labels:  json-api, json
Jsonapi Utils
Build JSON API-compliant APIs on Rails with no (or less) learning curve.
Stars: ✭ 191 (-29.52%)
Mutual labels:  json-api, json
Bricks
A standard library for microservices.
Stars: ✭ 142 (-47.6%)
Mutual labels:  json-api, json
Iotwifi
Raspberry Pi (arm) wifi configuration container. Configure and control wifi connectivity with a JSON based REST api.
Stars: ✭ 236 (-12.92%)
Mutual labels:  json-api, json
groq-cli
Run GROQ in your command line
Stars: ✭ 139 (-48.71%)
Mutual labels:  json-api, json-parser
Athena Express
athena-express makes it easier to execute SQL queries on Amazon Athena by chaining together a bunch of methods in the AWS SDK. This allows you to execute SQL queries AND fetch JSON results in the same synchronous call - well suited for web applications.
Stars: ✭ 111 (-59.04%)
Mutual labels:  json-api, json
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (-57.93%)
Mutual labels:  json-api, json
xijs
A business - oriented scene Js Library
Stars: ✭ 91 (-66.42%)
Mutual labels:  json-api, json-parser

MojoJson

MojoJson is an extremely simple and super fast JSON parser. The parser supports all standard Json formats and provides simple APIs for visit different types of the Json values. Also the core algorithm can be easily implemented by various programming languages.

The current implementations as follow:

  • For C#.

    The core parsing code only 400 lines, and the implementation only use the core .NET lib, and just has one file that can be easily integrated into any C# project.

  • For C.

    The core parsing code only 300 lines, and the implementation only use the C standard lib, and just has one C file that can be easily integrated into any C project.

    Note: the only different from C# is that the C code does not support SetEscapeString API to convert escaped strings, so the escaped strings will remain original state in C JsonValue.

License

MojoJson is licensed under the MIT License.

How to use

  • For C#

    • Parse Json string.
    var jsonValue = MojoJson.Json.Parse(string jsonString);
    
    • Whether to convert escaped strings when ParseString.
    /// default false
    MojoJson.Json.SetEscapeString(bool isEscapeString)
    
    • JsonValue is primitive type.
    public string AsString();
    public float  AsFloat();
    public int    AsInt();
    public bool   AsBool();
    public bool   IsNull();
    
    • JsonValue is JsonObject
    /// Get the JsonObject, that is a set of k-v pairs, and each value is JsonValue.
    public Dictionary<string, JsonValue> AsObject();
    
    /// Get the JsonValue from JsonObject by key.
    public JsonValue AsObjectGet(string key);
    
    /// Get the JsonObject from JsonObject by key.
    public Dictionary<string, JsonValue> AsObjectGetObject(string key);
    
    /// Get the JsonArray from JsonObject by key.
    public List<JsonValue> AsObjectGetArray(string key);
    
    /// Get the string from JsonObject by key.
    public string AsObjectGetString(string key);
    
    /// Get the float from JsonObject by key.
    public float AsObjectGetFloat(string key);
    
    /// Get the int from JsonObject by key.
    public int AsObjectGetInt(string key);
    
    /// Get the bool from JsonObject by key.
    public bool AsObjectGetBool(string key);
    
    /// Get the null from JsonObject by key.  
    public bool AsObjectGetIsNull(string key);
    
    • JsonValue is JsonArray.
    /// Get the JsonArray, that is JsonValue list.
    public List<JsonValue> AsArray();
    
    /// Get the JsonValue from JsonArray at index.
    public JsonValue AsArrayGet(int index);
    
    /// Get the JsonObject from JsonArray at index.
    public Dictionary<string, JsonValue> AsArrayGetObject(int index);
    
    /// Get the JsonArray from JsonArray at index.
    public List<JsonValue> AsArrayGetArray(int index);
    
    /// Get the string from JsonArray at index. 
    public string AsArrayGetString(int index);
    
    /// Get the float from JsonArray at index.
    public float AsArrayGetFloat(int index);
    
    /// Get the int from JsonArray at index.
    public int AsArrayGetInt(int index);
    
    /// Get the bool from JsonArray at index.
    public bool AsArrayGetBool(int index);
    
    /// Get the null from JsonArray at index.
    public bool AsArrayGetIsNull(int index);  
    
  • For C

    • Parse Json string.
    JsonValue* value = AJson->Parse(jsonString);
    
    • Free any JsonValue memory.
    AJson->Destroy(JsonValue* jsonValue);
    
    • JsonValue is JsonObject.
    bool        (*GetBool)  (JsonObject* object, const char* key, bool  defaultValue);
    int         (*GetInt)   (JsonObject* object, const char* key, int   defaultValue);
    float       (*GetFloat) (JsonObject* object, const char* key, float defaultValue);
    
    char*       (*GetString)(JsonObject* object, const char* key, const char* defaultValue);
    JsonObject* (*GetObject)(JsonObject* object, const char* key);
    JsonArray*  (*GetArray) (JsonObject* object, const char* key);
    
    • JsonValue is JsonArray.
    bool        (*GetBool)  (JsonArray* array, int index);
    int         (*GetInt)   (JsonArray* array, int index);
    float       (*GetFloat) (JsonArray* array, int index);
    
    char*       (*GetString)(JsonArray* array, int index);
    JsonObject* (*GetObject)(JsonArray* array, int index);
    JsonArray*  (*GetArray) (JsonArray* array, int index);
    

How was born

The original implementation and core algorithm came from the Json.h of the pure C game engine Mojoc.

Support

If the source code is useful for you, maybe you could buy me a coffee via Paypal-0.99 ☕️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].