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);
}