Code Monkey home page Code Monkey logo

json's Introduction

Alternative Go JSON parser

features

Supported types to unmarshal into:

  • int
  • float64
  • string
  • bool
  • RawMessage
  • structs made of all of these
  • slices made of all of these
  • pointers to all of these
  • map[string]{all of these}

Other basic types would be easy to add; I have not needed them yet. Note that the empty interface is not supported.

vs. encoding/json

  • this works on a string, not a []byte
  • encoding/json has nice error messages
  • encoding/json can decode to the empty interface
  • encoding/json supports the Unmarshaler interface

performance

For the use case I'm mostly interested in (parsing openRTB requests) I get twice the performance and half the allocs:

BenchmarkRTB-4       	   50000	     29093 ns/op	    2536 B/op	      39 allocs/op
BenchmarkRTBThem-4   	   20000	     63858 ns/op	    3888 B/op	      87 allocs/op

Similar for parsing large ElasticSearch bulk results:

BenchmarkESbulk-4    	    3000	    473237 ns/op	  177979 B/op	     830 allocs/op
BenchmarkESbulkThem-4	    2000	   1055068 ns/op	  200884 B/op	    2283 allocs/op

status

Works fine for us.

Build Status

GoDoc

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.