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