パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.1.4

gson

GSON によって生成された JSON を解析およびエンコードする(Minecraft の JSON を解析可能)

30日間ダウンロード
718
いいね数
14
Pub ポイント
40

パッケージをインストール

flutter pub add gson

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Gson は、GSON によって生成される JSON 構造(Minecraft で使用されるような複雑なフォーマットを含む)を処理することを目的とした、JSON データのパースおよびエンコードに特化した Dart パッケージです。Dart オブジェクトへの JSON のシリアライズおよびデシリアライズをスムーズに行えるため、ゲームデータや構造化された JSON 出力を取り扱うアプリケーションに最適です。カスタム型アダプターと柔軟なパース戦略をサポートしており、さまざまな JSON スキーマとの互換性を確保します。JSON 処理に対する正確な制御が必要な環境では特に有用です。

用途

  • Minecraft JSONデータの解析
  • 複雑なオブジェクト階層のシリアライズ
  • 動的JSON構造の処理
  • GSON によって生成された API との統合
  • カスタム JSON エンコード/デコード

主な機能

  • GSON互換のJSONをサポート
  • 柔軟な型アダプタ
  • 堅牢なエラー処理
  • 拡張可能なパースロジック
  • 軽量で効率的

適している対象

  • ゲーム開発プロジェクト
  • JSON中心のバックエンド統合
  • データ変換パイプライン
  • Minecraftデータ形式を使用するアプリケーション
  • 詳細なJSON制御を必要とする開発者

注意事項

  • 限定されたプラットフォームサポート(指定されたプラットフォームなし)
  • 複雑な型については手動での設定が必要です
  • 組み込みの検証なし
  • 外部のソースコードに依存しています
  • 大規模なJSON処理には最適化されていません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Forks Stargazers Issues BSD-2-Clause

dart-gson

Parses and encodes the json generated by GSON (Can parse minecraft's json)

This is just a simple parser and encoder.

Website (github pages): https://miniminelp.github.io/dart-gson/

Repository (github): https://github.com/MinimineLP/dart-gson

View dart docs: https://miniminelp.github.io/dart-gson/doc/api/

View on pub: https://pub.dev/packages/gson

Installation

Add this to your pubspec.yaml file

dependencies:
  gson: ^0.1.6

And to import use

import 'package:gson/gson.dart';

Usage

To decode you can use

gson.decode("{...}");

and to decode you can use

gson.encode({...});

As dart has no different variable types for numbers (there are just num, int and double), the api gives you types. So if you want a double for example in the output you have to insert

gson.encode(new Double(1.0)); // >> 1.0d

Also the compiler gives these classes back to you, so you have to get the value property

gson.decode("1.0d").value; // >> 1.0

because booleans are displayed as bytes in gson, the boolean value is in the Byte type.

gson.encode(true) // >> 1b
gson.decode("1b").value // >> 1
gson.decode("1b").boolValue // >> true (and 0b will be false)

The program can't find the difference between the number 1 and true / the number 0 / false, because in the code it is the same.

For more examples see example/example.dart

License

BSD 2-Clause License (See LICENSE)

Issues

Please post issues here

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。