FLUTTER ECOSYSTEM

damphat/json5-dart

dart 和 flutter 的 JSON5

json5-dart 專案封面
Stars
13
Forks
5
最近推送(UTC)
2025年2月23日
專案狀態
未封存
Phat GitHub avatar
GITHUB User

Phat ↗

Full-stack developer, open source enthusiast.

HCM City, Vietnam官方網站 ↗
語言Dart

技術主題

此儲存庫發佈的套件

使用的依賴

依賴清單 2 項
  • lints開發依賴^3.0.0
  • test開發依賴^1.14.4

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

JSON5 for Dart and Flutter

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.

Usage

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

References