ejson 0.4.0 copy "ejson: ^0.4.0" to clipboard
ejson: ^0.4.0 copied to clipboard

EJSON serialization. BSON is a binary format used to store JSON-like documents efficiently. EJSON extends JSON defining how all BSON types should be represented in JSON.

example/main.dart

// Copyright 2024 MongoDB, Inc.
// SPDX-License-Identifier: Apache-2.0

import 'dart:convert';

import 'package:ejson/ejson.dart';
import 'package:test/test.dart';

void main() {
  test('round-trip', () {
    final value = {
      'abe': [1, 4],
      'kat': <int>[],
    };
    final encoded = toEJson(value);
    final json = jsonEncode(encoded);
    print(json);
    final decoded = fromEJson<Map<String, List<int>>>(jsonDecode(json));
    expect(value, decoded);
  });
}
1
likes
140
points
40k
downloads

Publisher

verified publisherrealm.io

Weekly Downloads

EJSON serialization. BSON is a binary format used to store JSON-like documents efficiently. EJSON extends JSON defining how all BSON types should be represented in JSON.

Repository (GitHub)
View/report issues

Topics

#ejson #bson #json #build-runner #codegen

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection, ejson_annotation, objectid, sane_uuid, type_plus

More

Packages that depend on ejson