Coder Social home page Coder Social logo

go-smile's Introduction

go-smile :)

A Golang implementation of the Jackson-Smile binary JSON data format.

What's supported

  • Decoding is fully supported minus:

    • Big Decimals
  • Encoding is not yet supported

Developing

Build, format and run all tests with:

make

Tests

Test cases can be found under test/testdata. Each test case has a .smile and equivalent .json file.

Any new pairs of files added to this directory will be automatically included in the test suite.

Usage

package main

import (
	"fmt"
	"io/ioutil"
	"log"

	"github.com/zencoder/go-smile/smile"
)

func main() {
	var smileFile = "test/testdata/unicode.smile"

	b, err := ioutil.ReadFile(smileFile)
	if err != nil {
		log.Fatal("Error reading Smile file:", smileFile)
	}

	j, err := smile.DecodeToJSON(b)
	if err != nil {
		log.Fatal("Error decoding Smile file:", smileFile)
	}

	fmt.Println(j)
}
$ go run main.go 
{"child":"Niño","child-jp":"子供","chilllllllllllllllllllllllld":"Niñññññññññññññññññññññññño"}

The following convenience method is also provided for decoding to a Go representation of the JSON:

obj, err := smile.DecodeToObject(b)

go-smile's People

Contributors

thomshutt avatar mend-for-github-com[bot] 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.