Skip to content

crufter/nested

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

nested

The Nested Go package makes it easier to handle (too) big nested JSON structures.

How to use

Lets say you have the next JSON:

j := `{
	"hello": {
		"this": {
			"is": {
				"an": {
					"example": "hi"
				}
			}
		}
	}
}`

Now if you unmarshal it to u (pseudocode)

u := unmarshal(j)

You will have a hard time accessing members in u, like

u.(map[string]interface{})["hello"].(map[string]interface{})["this"].(map[string]interface{})	//... etc etc

But not with package Nested!

magic, ok := nested.Get(u, "hello.this.is.an.example")
fmt.Println(magic, ok)

Will output something like:

"hi" true

It's magic, really!

About

This Go package makes it easier to handle nested JSON documents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages