Giter Site home page Giter Site logo

guoyuefei / myjson Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 162 KB

๐Ÿ“My own json parsing library | Now only deserialization is implemented

Home Page: https://godoc.org/github.com/GuoYuefei/myjson/src/myjson

License: GNU Lesser General Public License v3.0

Go 100.00%

myjson's Introduction

MYJSON
GoDoc

MYJSON is a Go package that provides a fast and simple way to get values from a json document.

Getting Started

Install

To start using MyJson,Install Go and run go get:

$ go get -u github.com/GuoYuefei/myjson

This will retrieve the library.

Usage Example

package main
import (
	"fmt"
	"io/ioutil"
	"myjson"
)
func main() {
	bytes, e := ioutil.ReadFile("./src/myjson/yy.json")
	if e != nil {
		panic(e)
	}
	value := myjson.Get(bytes, "date.time.hour")
	//will see &{14} :  14
	fmt.Println(value, ": ", value.GetAsIntIgnore())
	//or you can get JsObeject that defined in newtypes.go
	jsob, _ := myjson.GetJsObject(bytes)
	//you can use function GetFromJsObject to get information that you want to get
	value = myjson.GetFromJsObject(jsob, "date.time.minutes")
	fmt.Println(value, ":", value.GetAsIntIgnore())
	fmt.Println(myjson.GetFromJsObject(jsob, "date.datetime").GetAsStringIgnore())
	//You can find methods in type Value, and you can quickly use them in name.
}

License

GNU Lesser General Public License v3.0 (LGPLv3.0)

Preface

The official json parsing library uses the reflection feature, which determines its speed is not too fast. I am still in the first grade of the master's degree, and I just want to challenge myself and write a json analysis library. It is still in the process of perfection, but the deserialization of json has been relatively friendly. Here I declare that I will improve the code, and I will maintain the json parsing library and improve the documentation whenever I have time.

myjson's People

Contributors

guoyuefei avatar

Stargazers

 avatar su avatar  avatar

Watchers

James Cloos avatar  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.