simdjson_dart 0.1.1 copy "simdjson_dart: ^0.1.1" to clipboard
simdjson_dart: ^0.1.1 copied to clipboard

Fast JSON for Dart using the simdjson C++ library over FFI. Lazy document access for large payloads plus jsonDecode-compatible decoding.

example/simdjson_dart_example.dart

import 'dart:convert';
import 'dart:typed_data';

import 'package:simdjson_dart/simdjson_dart.dart';

void main() {
  final bytes = Uint8List.fromList(
    utf8.encode(
      jsonEncode({
        'meta': {'total': 2},
        'items': [
          {'name': 'first', 'price': 9.5},
          {'name': 'second', 'price': 12.0},
        ],
      }),
    ),
  );

  // Selective access: only the requested values become Dart objects.
  final doc = SimdJsonDocument.parseBytes(bytes);
  try {
    print(doc.at('/meta/total')); // 2
    print(doc.at('/items/1/name')); // second
    print(doc.at('/items/9')); // null (missing)
  } finally {
    doc.close();
  }

  // Full decode, jsonDecode-compatible shapes.
  final decoded = simdJsonDecodeBytes(bytes) as Map<String, dynamic>;
  print((decoded['items'] as List).length); // 2
}
1
likes
0
points
162
downloads

Publisher

verified publisherdeveloperyusuf.com

Weekly Downloads

Fast JSON for Dart using the simdjson C++ library over FFI. Lazy document access for large payloads plus jsonDecode-compatible decoding.

Repository (GitHub)
View/report issues

Topics

#json #performance #ffi #parser #simd

License

unknown (license)

Dependencies

hooks, native_toolchain_c

More

Packages that depend on simdjson_dart