Analyseur et sérialiseur JSON rapide, efficace et facile à utiliser pour Dart.
🚧 Crimson est encore en phase de développement et n’est pas prêt pour une utilisation en production. Seule l’analyse est prise en charge pour l’instant 🚧
Caractéristiques
- 🏎️ Vite: Comme vraiment rapide. Crimson analyse JSON en une seule passe.
- 🌻 Facile à utiliser: Crimson est conçu pour être facile à utiliser et à comprendre.
- 💃 Flexible: Crimson peut partiellement analyser et sérialiser JSON.
- 🪶 Poids léger: Crimson est léger et n’a pas de dépendances tierces.
Usage
Après avoir ajouté Crimson à votre pubspec.yaml
vous pouvez commencer à annoter vos classes avec @json
et éventuellement @JsonField
:
import 'package:crimson/crimson.dart';
part 'tweet.g.dart';
@json
class Tweet {
DateTime? created_at;
@JsonField(name: 'text')
String? tweet;
int? reply_count;
int? retweet_count;
int? favorite_count;
}
Maintenant tu n’as plus qu’à courir pub run build_runner build
pour générer le code nécessaire.
import 'package:crimson/crimson.dart';
void main() {
final jsonBytes = downloadTweets();
final crimson = Crimson(jsonBytes);
final tweets = crimson.parseTweetList();
}
C’est ça! Vous pouvez maintenant analyser et sérialiser facilement JSON.
Licence
Copyright 2022 Simon Choi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
GitHub
Voir Github