패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.4

gson

GSON이 생성한 JSON을 파싱하고 인코딩합니다 (Minecraft의 JSON을 분석할 수 있음)

30일 다운로드
718
좋아요
14
Pub 점수
40

패키지 설치

flutter pub add gson

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Gson은 GSON에서 생성한 JSON 구조(마인크래프트에서 사용하는 복잡한 형식 포함)를 처리하도록 특별히 설계된 Dart 패키지로, JSON 데이터를 파싱하고 인코딩하는 데 사용됩니다. JSON을 Dart 객체로 쉽게 직렬화 및 역직렬화할 수 있어 게임 데이터나 구조화된 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.