Giter Site home page Giter Site logo

binaryjson.ooc's Introduction

BinaryJson

An ooc implemention of KLab's Binary JSON.

Introduction

The original description can be found in KLab's game engine PlaygroundOSS. This engine hasn't been updated for a while but almost everything is still being used in KLab's game, such as school idol festival.

Feature

  • Compact
  • Simple(only 500 lines)
  • No Dependency(only use ooc/sdk)
  • Fast

Description

Everyting(Int, String, Object...) is a JsonNode. You can get its value through JsonNode get. By JsonNode toString, json node can be translated to a normal json file. Even though JsonNode provides addVal and addKey, they only work for Object and Array.

To modify the content of a JsonNode, access data directly. (Will be updated in future)

To parse a binary-json, use class BJson. BJson will parse a binary-json file into JsonNode, and save results in BJson root. Notice that root is a JsonArray. It means if your json file is a single-object, you should use BJson root data[0].

Usage

Currently it only accepts BinarySequenceReader

Convert a binary-json in memory to text:

fw := FileWriter new(args[1])
br := BinarySequenceReader new(BufferReader new(Buffer new(buf, buflength)))
// choose file endianness
// br endianness = ENDIANNESS big 
json := BJson new(br)
fw write(json root toString())
fw close()

TODO

  • More tests
  • Add get ~index and operator overload for array/object
  • endianness safe

binaryjson.ooc's People

Contributors

horasal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.