{"id":13548344,"url":"https://github.com/couchbase/fleece","last_synced_at":"2025-10-07T15:20:10.078Z","repository":{"id":39078128,"uuid":"46376800","full_name":"couchbase/fleece","owner":"couchbase","description":"A super-fast, compact, JSON-equivalent binary data format","archived":false,"fork":false,"pushed_at":"2024-08-05T23:50:48.000Z","size":4464,"stargazers_count":309,"open_issues_count":14,"forks_count":32,"subscribers_count":52,"default_branch":"master","last_synced_at":"2024-08-06T16:10:44.180Z","etag":null,"topics":["data-format","delta-compression","json","persistent-data-structure"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2015-11-17T21:32:57.000Z","updated_at":"2024-08-06T16:10:49.593Z","dependencies_parsed_at":"2023-02-15T04:45:40.291Z","dependency_job_id":"f5511e57-6f77-44e1-b653-7e240b8c08ab","html_url":"https://github.com/couchbase/fleece","commit_stats":null,"previous_names":["couchbaselabs/fleece"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Ffleece","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Ffleece/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Ffleece/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Ffleece/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase","download_url":"https://codeload.github.com/couchbase/fleece/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895738,"owners_count":20851321,"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":["data-format","delta-compression","json","persistent-data-structure"],"created_at":"2024-08-01T12:01:09.112Z","updated_at":"2025-10-07T15:20:10.073Z","avatar_url":"https://github.com/couchbase.png","language":"C++","funding_links":[],"categories":["C++","json"],"sub_categories":[],"readme":"![Build and Test](https://github.com/couchbaselabs/fleece/workflows/Build%20and%20Test/badge.svg)\n\n# Fleece\n\n__Fleece__ is a binary encoding for semi-structured data. Its data model is a superset of JSON, adding support for binary values. It is designed to be:\n\n* **Very fast to read:** No parsing is needed, and the data can be navigated and read without any heap allocation. Fleece objects are internal pointers into the raw data. Arrays and dictionaries can be random-accessed. Performance on real-world-scale data has been clocked at 20x that of JSON. (Want proof? See the [benchmark](Performance.md).)\n* **Compact:** Simple values will be about the same size as JSON. Complex ones may be much smaller, since repeated values, especially strings, only need to be stored once.\n* **Efficient to convert into native objects:** Numbers are binary, strings are raw UTF-8 without quoting, binary data is not base64-encoded. Storing repeated values once means they only need to be converted into native objects once.\n* **Appendable:** Fleece is what's known as a [persistent data structure](https://en.wikipedia.org/wiki/Persistent_data_structure). A Fleece document can be mutated by appending data to it. The mutation is in effect a delta, so it's usually much smaller than the original document. And the original document is unchanged, which is great for concurrency as well as (simple) version control.\n\n## What You Get\n\n* Documentation, including\n    * **High-level API guide \"[Using Fleece](https://github.com/couchbaselabs/fleece/wiki/Using-Fleece)\"**\n    * The [design document](Fleece.md), with details on the data format and other internals\n    * An [example](Example.md) showing the details of the encoding of a specific data structure, and a walkthrough of what happens when a program works with the resulting Fleece objects\n* A C++ reference implementation, including:\n    * Encoder and decoder/accessors\n    * Extensions for converting JSON directly to Fleece or vice versa\n    * Extensions for encoding from and decoding to Objective-C (Foundation) object trees\n    * Extensions for mutable values, making it easy to modify Fleece documents and then save them again\n    * Extensions for delta compression\n    * Unit tests\n    * Some simple performance benchmarks\n* C++ and C APIs\n* A command-line tool, `fleece`, that can convert JSON to Fleece or vice versa, or dump Fleece data in a human-readable form that shows the internal structure\n* Some experimental stuff:\n    * A [Hash-Array-Mapped Trie](https://en.wikipedia.org/wiki/Hash_array_mapped_trie) implementation for building highly scaleable persistent hash tables in Fleece\n    * At the other extreme, an extremely compact binary tree of strings that might find a use someday\n\n## FAQ\n\n**Q: Why does the world need yet another binary JSON encoding?**  \nA: Excellent question, sock puppet! Fleece is different from [BSON](http://bsonspec.org), [PSON](https://github.com/dcodeIO/PSON), etc. in that it's been carefully designed to not need parsing or heap allocation. In performance tests with other binary formats I found that, while they were faster to parse than JSON, the total time was still dominated by allocating and freeing the resulting objects, as well as the conversion from UTF-8 data to platform strings. (I was using Objective-C, but similar issues would arise if using STL or GLib or other collection frameworks.) The way around this is to structure the encoded data more like a memory dump, with \"pointers\" (relative byte offsets) and fixed-width random-accessible arrays. That's what Fleece does. As a result, it's many times faster to work with than JSON; [literally _20x faster_](Performance.md) in the included benchmark run on a Macbook Pro.\n\n**Q: Can I use it in \\$LANGUAGE?** [where \\$LANGUAGE not in (\"C++\", \"C\")]  \nA: Not currently. It would be very nice to more bindings, and the C API should make that fairly\nstraightforward since it's easy to call from other languages. (But any real API should follow\nthe language's idioms, instead of being a direct translation!)\n\n**Q: Why didn't you write this in \\$NEW_LANGUAGE instead of crufty C++?**  \nA: I probably should have! \\$NEW_LANGUAGE is deservedly attracting a lot of attention for its combination of safety, readable syntax, and support for modern programming paradigms. I've been trying out \\$NEW_LANGUAGE and want to write more code in it. But for this I chose C++ because it's supported on all platforms, lots of people know how to use it, and it still supports high-level abstractions (unlike C.)\n\n**Q: Why the name \"Fleece\"?**  \nA: It's a reference to the mythical [Golden Fleece](https://en.wikipedia.org/wiki/Golden_Fleece), the treasure sought by Jason and the Argonauts.\n\n**Q: Who wrote this?**  \n[Jens Alfke](https://github.com/snej), with design input from [Volker Mische](https://github.com/vmx) and [Dave Rigby](https://github.com/daverigby), and much help with portability and bug-fixing from [Jim Borden](https://github.com/borrrden). (And thanks to Mark Nunberg for the excellent [jsonsl](https://github.com/mnunberg/jsonsl) parser.)\n\n## Status\n\nFleece is in active use and development. It is a core component of Couchbase Lite, via the [LiteCore](https://github.com/couchbase/couchbase-lite-core) library.\n\n## Requirements / Compatibility\n\n* Fleece builds with Xcode, Clang, GCC and MSVC. Most of the code is C++17, but some newer parts need C++20. (Yes, there are some Objective-C++ source files (`.mm`), but those are only used to provide Objective-C glue and Mac/iOS specific benchmarks. You can ignore them on other platforms.)\n* There are no dependencies on any external libraries, other than the standard C library and the C++ STL.\n* It _should_ work correctly, and create interoperable data, on both little-endian and big-endian CPUs, but admittedly we are not currently testing or using Fleece on any big-endian platforms.\n\nWe use GitHub CI, covering Clang, GCC, Xcode and MSVC on macOS, Linux and Windows. If you encounter portability problems, please file an issue and we'll fix it.\n\n## License\n\nCouchbase Business Source License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Ffleece","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase%2Ffleece","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Ffleece/lists"}