All Projects → go-edn → Edn

go-edn / Edn

Licence: bsd-3-clause
Go implementation of EDN (Extensible Data Notation)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Edn

X509
A PHP library for X.509 public key certificates, attribute certificates, certification requests and certification path validation.
Stars: ✭ 27 (-64.47%)
Mutual labels:  encoding
Ffmpeg Encoding Course
An introduction to FFmpeg and its tools
Stars: ✭ 53 (-30.26%)
Mutual labels:  encoding
Simplebase
.NET library for encoding/decoding Base16, Base32, Base58 and Base85.
Stars: ✭ 64 (-15.79%)
Mutual labels:  encoding
Rust Multibase
Multibase in rust
Stars: ✭ 30 (-60.53%)
Mutual labels:  encoding
Vsad
this is the code release for ''Weakly Supervised PatchNets: Describing and Aggregating Local Patches for Scene Recognition''
Stars: ✭ 44 (-42.11%)
Mutual labels:  encoding
Php Sdk
Transloadit's official PHP SDK
Stars: ✭ 55 (-27.63%)
Mutual labels:  encoding
Netbeans Encoding Plugin
Encoding Support
Stars: ✭ 20 (-73.68%)
Mutual labels:  encoding
Mlbox
MLBox is a powerful Automated Machine Learning python library.
Stars: ✭ 1,199 (+1477.63%)
Mutual labels:  encoding
Fast ber
A C++11 ASN.1 BER Encoding and Decoding Library
Stars: ✭ 54 (-28.95%)
Mutual labels:  encoding
Yacr
Yet another CSV Reader
Stars: ✭ 62 (-18.42%)
Mutual labels:  encoding
Cryptii
Web app and framework offering modular conversion, encoding and encryption
Stars: ✭ 971 (+1177.63%)
Mutual labels:  encoding
Edn Data
EDN parser and generator that works with plain JS data, with support for TS and node streams
Stars: ✭ 44 (-42.11%)
Mutual labels:  edn
Idna Convert
Pure PHP IDNA Converter
Stars: ✭ 58 (-23.68%)
Mutual labels:  encoding
Mpedn
EDN I/O library for Objective-C (MacOS and iOS)
Stars: ✭ 28 (-63.16%)
Mutual labels:  edn
Cause
An EDN-like CRDT (Causal Tree) for Clojure & ClojureScript that automatically tracks history and resolves conflicts.
Stars: ✭ 68 (-10.53%)
Mutual labels:  edn
Bcnencoder.net
Cross-platform texture encoding libary for .NET. With support for BC1-3/DXT, BC4-5/RGTC and BC7/BPTC compression. Outputs files in ktx or dds formats.
Stars: ✭ 28 (-63.16%)
Mutual labels:  encoding
Qs
Go module for encoding structs into URL query parameters
Stars: ✭ 55 (-27.63%)
Mutual labels:  encoding
Ldpc
C and MATLAB implementation for LDPC encoding and decoding
Stars: ✭ 76 (+0%)
Mutual labels:  encoding
Fif
Stack-based Programming in Clojure(script)
Stars: ✭ 71 (-6.58%)
Mutual labels:  edn
Bincode
A binary encoder / decoder implementation in Rust.
Stars: ✭ 1,100 (+1347.37%)
Mutual labels:  encoding

Go implementation of EDN, extensible data notation

GoDoc

go-edn is a Golang library to read and write EDN (extensible data notation), a subset of Clojure used for transferring data between applications, much like JSON or XML. EDN is also a very good language for configuration files, much like a JSON-like version of YAML.

This library is heavily influenced by the JSON library that ships with Go, and people familiar with that package should know the basics of how this library works. In fact, this should be close to a drop-in replacement for the encoding/json package if you only use basic functionality.

This implementation is complete, stable, and presumably also bug free. This is why you don't see any changes in the repository.

If you wonder why you should (or should not) use EDN, you can have a look at the why document.

Installation and Usage

The import path for the package is olympos.io/encoding/edn

To install it, run:

go get olympos.io/encoding/edn

To use it in your project, you import olympos.io/encoding/edn and refer to it as edn like this:

import "olympos.io/encoding/edn"

//...

edn.DoStuff()

The previous import path of this library was gopkg.in/edn.v1, which is still permanently supported.

Quickstart

You can follow http://blog.golang.org/json-and-go and replace every occurence of JSON with EDN (and the JSON data with EDN data), and the text makes almost perfect sense. The only caveat is that, since EDN is more general than JSON, go-edn stores arbitrary maps on the form map[interface{}]interface{}.

go-edn also ships with keywords, symbols and tags as types.

For a longer introduction on how to use the library, see introduction.md. If you're familiar with the JSON package, then the API Documentation might be the only thing you need.

Example Usage

Say you want to describe your pet forum's users as EDN. They have the following types:

type Animal struct {
	Name string
	Type string `edn:"kind"`
}

type Person struct {
	Name      string
	Birthyear int `edn:"born"`
	Pets      []Animal
}

With go-edn, we can do as follows to read and write these types:

import "olympos.io/encoding/edn"

//...


func ReturnData() (Person, error) {
	data := `{:name "Hans",
              :born 1970,
              :pets [{:name "Cap'n Jack" :kind "Sparrow"}
                     {:name "Freddy" :kind "Cockatiel"}]}`
	var user Person
	err := edn.Unmarshal([]byte(data), &user)
	// user '==' Person{"Hans", 1970,
	//             []Animal{{"Cap'n Jack", "Sparrow"}, {"Freddy", "Cockatiel"}}}
	return user, err
}

If you want to write that user again, just Marshal it:

bs, err := edn.Marshal(user)

Dependencies

go-edn has no external dependencies, except the default Go library. However, as it depends on math/big.Float, go-edn requires Go 1.5 or higher.

License

Copyright © 2015-2019 Jean Niklas L'orange and contributors

Distributed under the BSD 3-clause license, which is available in the file LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].