gg_json_hash 1.0.1 copy "gg_json_hash: ^1.0.1" to clipboard
gg_json_hash: ^1.0.1 copied to clipboard

Hashes JSON objects deeply. Good or JSON comparison, sync and more.

example/gg_json_hash_example.dart

#!/usr/bin/env dart
// @license
// Copyright (c) 2019 - 2024 Dr. Gabriel Gatzsche. All Rights Reserved.
//
// Use of this source code is governed by terms that can be
// found in the LICENSE file in the root of this package.

import 'dart:convert';

import 'package:gg_json_hash/src/gg_json_hash.dart';

Future<void> main() async {
  // Write hashes into a JSON string
  const json = '{"key": "value"}';
  final jsonString = const JsonHash().applyToString(json);
  print(jsonString); // '{"key":"value","_hash":"5Dq88zdSRIOcAS+WM/lYYt"}');

  // Write hashes into a JSON object
  final jsonMap = {'hellod': 'world'};
  final hashedJson = const JsonHash().applyTo(jsonMap);
  final hashedJsonString = jsonEncode(hashedJson);
  print(
    hashedJsonString,
  ); // {"hellod":"world","_hash":"i811N7aI03kp1AIL6j/Bmo"}
}
0
likes
0
points
488
downloads

Publisher

verified publisherinlavigo.com

Weekly Downloads

Hashes JSON objects deeply. Good or JSON comparison, sync and more.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto, path

More

Packages that depend on gg_json_hash