godot-bson/README.md

18 lines
996 B
Markdown
Raw Permalink Normal View History

2025-02-17 15:54:51 -08:00
# BSON for the Godot Engine
This is a simple BSON serializer and deserializer written in GDScript that is originally designed to be compatible with [JSON for Modern C++](https://json.nlohmann.me/)'s BSON components, but it can be used with any other BSON tool.
2025-02-17 15:49:47 -08:00
2025-02-17 15:54:51 -08:00
From [bsonspec.org](https://bsonspec.org/):
BSON, short for Bin­ary [JSON](http://json.org), is a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. Like JSON, BSON sup­ports the em­bed­ding of doc­u­ments and ar­rays with­in oth­er doc­u­ments and ar­rays.
This plugin is useful for server/client communication, interacting with MongoDB, reducing JSON file sizes, etc.
After enabling this plugin in your Godot project settings, you can access the BSON object with:
```
BSON.to_bson(Dictionary)
```
and
```
BSON.from_bson(PackedByteArray)
```
You can also test out this plugin with `/BSON Examples/dunk.tscn`. This example will take your JSON, serialize it to BSON, then deserialize it back to JSON.