{"id":13420328,"url":"https://github.com/vincenthz/libjson","last_synced_at":"2025-04-05T13:09:00.096Z","repository":{"id":56825566,"uuid":"454319","full_name":"vincenthz/libjson","owner":"vincenthz","description":"a JSON parser and printer library in C. easy to integrate with any model.","archived":false,"fork":false,"pushed_at":"2024-05-09T22:56:04.000Z","size":62,"stargazers_count":277,"open_issues_count":8,"forks_count":98,"subscribers_count":37,"default_branch":"master","last_synced_at":"2024-10-12T20:43:53.754Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://projects.snarc.org/libjson/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vincenthz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2009-12-31T11:00:24.000Z","updated_at":"2024-09-18T10:56:56.000Z","dependencies_parsed_at":"2024-05-01T23:11:57.328Z","dependency_job_id":"c3a65bbd-5df0-4bd4-9602-769f4720e376","html_url":"https://github.com/vincenthz/libjson","commit_stats":{"total_commits":73,"total_committers":13,"mean_commits":5.615384615384615,"dds":"0.36986301369863017","last_synced_commit":"bd0cad8b3f063bedd95d27b32211b9fc388cf24f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincenthz%2Flibjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincenthz%2Flibjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincenthz%2Flibjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincenthz%2Flibjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vincenthz","download_url":"https://codeload.github.com/vincenthz/libjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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":[],"created_at":"2024-07-30T22:01:31.362Z","updated_at":"2025-04-05T13:09:00.070Z","avatar_url":"https://github.com/vincenthz.png","language":"C","readme":"libjson - simple and efficient json parser and printer in C\n===========================================================\n\nIntroduction\n------------\n\nlibjson is a simple library without any dependancies to parse and pretty print\nthe JSON format ([RFC 4627](https://www.ietf.org/rfc/rfc4627.txt)). The JSON format is a concise and structured data\nformat.\n\nFeatures\n--------\n\n* interruptible parser: append data to the state how you want it.\n* No object model integrated\n* Small codebase: handcoded parser and efficient factorisation make the code smalls and perfect for embedding.\n* Fast: use efficient code and small parsing tables for maximum efficiency.\n* Full JSON support.\n* UTF8 validation of the input.\n* No number conversion: user convert data the way they want.\n* Secure: optional limits on nesting level, and on data size.\n* Optional comments: in YAML/python style and C style.\n* Optional user defined allocation functions.\n\nlibjson parser is an interruptible handcoded state parse. the parser takes\ncharacter or string as input. Since it's interruptible, it's up to the\nuser to feed the stream to the parser, which permits complete flexibility\nas to whether the data is coming from a pipe, a network socket, a file on disk,\na serial line, or crafted by the user.\n\nThe parser doesn't create an object tree for you, but each time it comes up\nwith an element in this data, it just callback to the user with the type found and\nfor some type, the data associated with it. It can be compared to the SAX way of XML,\nhence it's called SAJ (Simple API for JSon).\n\nThe parser doesn't convert number to any native C format, but instead callback\nwith a string that is a valid JSon number. JSon number can be of any size,\nso that's up to user to decide whetever or not, the number can map to native C type\nint32\\_t, int64\\_t, or a complex integer type. As well the user has a choice to\nrefuse the integer at the callback stage if the length is not appropriate.\n\nThe parser optionally allows YAML and/or C comments to be ignored if the config\nstructure is set accordingly, otherwise a JSON\\_ERROR\\_COMMENT\\_NOT\\_ALLOWED is returned.\n\nEmbedding \u0026 Build system\n------------------------\n\nThe primary use case of this pieces of code is providing JSON capability to\nyour program or library, without adding an extra build dependency.  You can add\nit to your project directly, and integrate it without any fuss.\n\nThe \\\"build system\\\" available with the library is just a way to test that\neverything in the library conforms to specifications and features. It's not\nnecessarily intended as a way to build portable dynamic library (.so or .dll).\nIt should works in simple case of building on Linux and BSDs though.\n\nFor others use (eg. windows, OS X, obscure unixes), it is much simpler to\nintegrate the library in your program or library directly.\n\nSimple build fixes to build on more platforms will be accepted though.\n\nContributing\n------------\n\nOpen a pull request with your new feature, simple code fix, or documentation\nfixes. Please conform to coding style, and to the spirit of the library:\npolicy is not imposed by the library.\n\nThe Parser API\n--------------\n\nThe parser API is really simple, totaling only 5 API calls:\n\n * json\\_parser\\_init\n * json\\_parser\\_char\n * json\\_parser\\_string\n * json\\_parser\\_is\\_done\n * json\\_parser\\_free\n\njson\\_parser\\_init initializes a new parser context from a parser config and\ntakes a callback + userdata. This callback function is used everything the\nparser need to communicate a type and value to the client side of the library.\n\njson\\_parser\\_char take one character and inject it in the parser. on parsing\nsuccess it will return a 0 value, but on parsing error it returns a parsing\nerror that represents the type of the error encounters. see JSON\\_ERROR\\_\\*\nfor the full set of return values.\n\njson\\_parser\\_string is similar to json\\_parser\\_char except that it takes a string\nand a length.  it also returns the number of character processed, which is\nuseful when an parser error happened in the stream to pinpoint where.\n\njson\\_parser\\_is\\_done permits to test whetever or not the parser is in a\nterminated state. it involves not beeing into any structure.\n\njson\\_parser\\_free is the opposite of init, it just free the allocated structure.\n\nThe Printer API\n---------------\n\nthe printer API is simple too:\n\n * json\\_printer\\_init\n * json\\_printer\\_free\n * json\\_printer\\_pretty\n * json\\_printer\\_raw\n\njson\\_printer\\_init initialise a printing context and takes a callback + userdata\nthat will be called for every character that the printer wants to output. the\ncaller can have the printer callback redirect to anything it wants.\n\njson\\_printer\\_free is the opposite of init\n\njson\\_printer\\_raw takes a json type and an optional data and length value\ndepending on the type. it's up to the caller to verify that the order of type\nare JSON-compliant, otherwise the generated document won't be able to be parsed\nagain.\n\njson\\_printer\\_pretty works like json\\_printer\\_raw but is targetted for human\nreading by appending newlines and spaces\n\nJsonlint utility program\n------------------------\n\njsonlint utility provided with the library to verify, or reformat json stream.\nalso useful as example on how to use the library.\n","funding_links":[],"categories":["TODO scan for Android support in followings","JSON","进程间通信"],"sub_categories":["Json"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincenthz%2Flibjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvincenthz%2Flibjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincenthz%2Flibjson/lists"}