v0.8.2
json5
コメントと末尾のコンマをサポートするJSON5のエンコードおよびデコード用の軽量ライブラリです。
20いいね 1.1万30日間ダウンロード150Pub ポイント
AndroidiOSWebmacOSWindowsLinux
Dart および Flutter の JSON5
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
Dart CI
This Dart package is a port of JSON5, originally written in pure JavaScript.
It follows the same algorithms and specifications as the original JSON5, ensuring identical behavior.
However, Dart has different naming conventions—see the example below.
import 'package:json5/json5.dart';
void main() {
var obj = JSON5.parse('''
{
/* Comment block */
name: { first: "Phat" },
lang: ["C++", "Dart", "Kotlin"],
nums: [NaN, Infinity, -Infinity]
} // End object
''');
var compact = JSON5.stringify(obj);
print(compact);
var pretty = JSON5.stringify(obj, space: 2);
print(pretty);
}