{"id":15036127,"url":"https://github.com/scottcgi/mojojson","last_synced_at":"2025-04-10T01:14:10.988Z","repository":{"id":85815342,"uuid":"117350340","full_name":"scottcgi/MojoJson","owner":"scottcgi","description":"A simple and fast JSON parser.","archived":false,"fork":false,"pushed_at":"2021-04-17T08:19:28.000Z","size":79,"stargazers_count":296,"open_issues_count":2,"forks_count":38,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-10T01:14:06.068Z","etag":null,"topics":["csharp-library","json","json-api","json-lib","json-libraries","json-library","json-parser"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scottcgi.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://scottcgi.github.io/donate/","https://www.paypal.me/PayScottcgi/0.99"]}},"created_at":"2018-01-13T14:32:51.000Z","updated_at":"2025-03-02T05:27:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd54edc7-64b5-4d94-a9db-70ef3569ccc6","html_url":"https://github.com/scottcgi/MojoJson","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottcgi%2FMojoJson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottcgi%2FMojoJson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottcgi%2FMojoJson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottcgi%2FMojoJson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scottcgi","download_url":"https://codeload.github.com/scottcgi/MojoJson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp-library","json","json-api","json-lib","json-libraries","json-library","json-parser"],"created_at":"2024-09-24T20:30:14.419Z","updated_at":"2025-04-10T01:14:10.969Z","avatar_url":"https://github.com/scottcgi.png","language":"C","funding_links":["https://scottcgi.github.io/donate/","https://www.paypal.me/PayScottcgi/0.99"],"categories":[],"sub_categories":[],"readme":"## MojoJson v1.2.3\n\nMojoJson 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.\n\n* Released versions in [releases](https://github.com/scottcgi/MojoJson/releases).\n* Release changes in [ChangeLog](https://github.com/scottcgi/MojoJson/blob/master/ChangeLog.md).\n\n\nThe current implementations as follow:\n\n* For C#.   \n  \n  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.\n\n* For C.  \n  \n  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.  \n\n  **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.\n\n\n## License\n\nMojoJson is licensed under the [MIT License](https://github.com/scottcgi/MojoJson/blob/master/LICENSE).\n\n## How to use\n\n* For C#\n\n  * Parse Json string.\n\n  ```csharp\n  var jsonValue = MojoJson.Json.Parse(string jsonString);\n  ```\n\n  * Whether to convert escaped strings when **ParseString**.\n\n  ```csharp\n  /// default false\n  MojoJson.Json.SetEscapeString(bool isEscapeString)\n  ```\n\n  * JsonValue is **primitive** type.\n\n  ```csharp\n  public string AsString();\n  public float  AsFloat();\n  public int    AsInt();\n  public bool   AsBool();\n  public bool   IsNull();\n  ```\n  \n  * JsonValue is **JsonObject** \n\n  ```csharp\n  /// Get the JsonObject, that is a set of k-v pairs, and each value is JsonValue.\n  public Dictionary\u003cstring, JsonValue\u003e AsObject();\n  \n  /// Get the JsonValue from JsonObject by key.\n  public JsonValue AsObjectGet(string key);\n  \n  /// Get the JsonObject from JsonObject by key.\n  public Dictionary\u003cstring, JsonValue\u003e AsObjectGetObject(string key);\n  \n  /// Get the JsonArray from JsonObject by key.\n  public List\u003cJsonValue\u003e AsObjectGetArray(string key);\n  \n  /// Get the string from JsonObject by key.\n  public string AsObjectGetString(string key);\n  \n  /// Get the float from JsonObject by key.\n  public float AsObjectGetFloat(string key);\n  \n  /// Get the int from JsonObject by key.\n  public int AsObjectGetInt(string key);\n  \n  /// Get the bool from JsonObject by key.\n  public bool AsObjectGetBool(string key);\n  \n  /// Get the null from JsonObject by key.  \n  public bool AsObjectGetIsNull(string key);\n  ```\n\n  * JsonValue is **JsonArray**.\n\n  ```csharp\n  /// Get the JsonArray, that is JsonValue list.\n  public List\u003cJsonValue\u003e AsArray();\n  \n  /// Get the JsonValue from JsonArray at index.\n  public JsonValue AsArrayGet(int index);\n  \n  /// Get the JsonObject from JsonArray at index.\n  public Dictionary\u003cstring, JsonValue\u003e AsArrayGetObject(int index);\n  \n  /// Get the JsonArray from JsonArray at index.\n  public List\u003cJsonValue\u003e AsArrayGetArray(int index);\n  \n  /// Get the string from JsonArray at index. \n  public string AsArrayGetString(int index);\n  \n  /// Get the float from JsonArray at index.\n  public float AsArrayGetFloat(int index);\n  \n  /// Get the int from JsonArray at index.\n  public int AsArrayGetInt(int index);\n  \n  /// Get the bool from JsonArray at index.\n  public bool AsArrayGetBool(int index);\n  \n  /// Get the null from JsonArray at index.\n  public bool AsArrayGetIsNull(int index);  \n  ```\n\n* For C\n  \n  * Parse Json string.\n  ```c\n  JsonValue* value = AJson-\u003eParse(jsonString);\n  ```\n\n  * Free any JsonValue memory.\n  ```c\n  AJson-\u003eDestroy(JsonValue* jsonValue);\n  ```\n\n  * JsonValue is **JsonObject**.  \n\n  ```c\n  bool        (*GetBool)  (JsonObject* object, const char* key, bool  defaultValue);\n  int         (*GetInt)   (JsonObject* object, const char* key, int   defaultValue);\n  float       (*GetFloat) (JsonObject* object, const char* key, float defaultValue);\n\n  char*       (*GetString)(JsonObject* object, const char* key, const char* defaultValue);\n  JsonObject* (*GetObject)(JsonObject* object, const char* key);\n  JsonArray*  (*GetArray) (JsonObject* object, const char* key);\n  ```\n\n  * JsonValue is **JsonArray**.  \n\n  ```c\n  bool        (*GetBool)  (JsonArray* array, int index);\n  int         (*GetInt)   (JsonArray* array, int index);\n  float       (*GetFloat) (JsonArray* array, int index);\n\n  char*       (*GetString)(JsonArray* array, int index);\n  JsonObject* (*GetObject)(JsonArray* array, int index);\n  JsonArray*  (*GetArray) (JsonArray* array, int index);\n  ```\n\n    \n## How was born\n\nThe original implementation and core algorithm came from the [Json.h](https://github.com/scottcgi/Mojoc/blob/master/Engine/Toolkit/Utils/Json.h) of the pure C game engine [Mojoc](https://github.com/scottcgi/Mojoc).\n\n\n## Support\n\nIf the source code is **useful** or **helpful** for you, maybe buy me a coffee via **Sponsor Button**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottcgi%2Fmojojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscottcgi%2Fmojojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottcgi%2Fmojojson/lists"}