https://github.com/damphat/json5-dart
JSON5 for dart and flutter
https://github.com/damphat/json5-dart
dart flutter json5
Last synced: 4 months ago
JSON representation
JSON5 for dart and flutter
- Host: GitHub
- URL: https://github.com/damphat/json5-dart
- Owner: damphat
- License: mit
- Created: 2020-10-17T19:15:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-23T14:48:24.000Z (over 1 year ago)
- Last Synced: 2025-10-23T07:32:27.095Z (8 months ago)
- Topics: dart, flutter, json5
- Language: Dart
- Homepage: https://pub.dev/packages/json5
- Size: 48.8 KB
- Stars: 13
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## JSON5 for Dart and Flutter

This Dart package is a port of [JSON5](https://github.com/json5/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
```dart
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
- [JSON5 Official Site](https://json5.org/)
- [JSON5 JavaScript Implementation](https://github.com/json5/json5)