json_inference 0.2.0 json_inference: ^0.2.0 copied to clipboard
A Dart package providing functionality to infer JSON data types.
example/json_inference_example.dart
// ignore_for_file: avoid_print
import 'dart:convert';
import 'package:json_inference/json_inference.dart';
void main() {
const a = {
'value1': 1,
'value2': 2.0,
'value3': '3',
'value4': true,
};
const b = {
'value1': 4,
'value2': 5,
'value3': 6,
};
final valueType = inferValueTypes([a, b]);
print(const JsonEncoder.withIndent(' ').convert(a));
print(const JsonEncoder.withIndent(' ').convert(b));
print(const JsonEncoder.withIndent(' ').convert(valueType));
}