package
0.21.9
Repository: https://github.com/dosco/graphjin.git
Documentation: pkg.go.dev

# README

JSN - Fast low allocation JSON library

Design

This libary is designed as a set of seperate functions to extract data and mutate JSON. All functions are focused on keeping allocations to a minimum and be as fast as possible. The functions don't validate the JSON a seperate Validate function does that.

The JSON parsing algo processes each object {} or array [] in a bottom up way where once the end of the array or object is found only then the keys within it are parsed from the top down.

{"id":1,"posts": [{"title":"PT1-1","description":"PD1-1"}], "full_name":"FN1","email":"E1" }

id: 1

posts: [{"title":"PT1-1","description":"PD1-1"}]

[{"title":"PT1-1","description":"PD1-1"}]

{"title":"PT1-1","description":"PD1-1"}

title: "PT1-1"

description: "PD1-1

full_name: "FN1"

email: "E1"

Functions

  • Strip: Strip a path from the root to a child node and return the rest
  • Replace: Replace values by key
  • Get: Get all keys
  • Filter: Extract specific keys from an object
  • Tree: Fetch unique keys from an array or object

# Functions

Clear function wipes all scalar values from the json including those directly in an array.
Filter function filters the JSON keeping only the provided keys and removing all others.
Keys function fetches values for the provided keys.
Keys function fetches all the unique keys in the JSON data in order of their occurrence.
Replace function replaces key-value pairs provided in the `from` argument with those in the `to` argument.
Strip function strips out all values from the JSON data expect for the provided path.
No description provided by the author
Validate function validates JSON.
ValidateBytes validates JSON b.
Value function is a utility function to sanitize returned values.

# Structs

Field struct holds a JSON key and value.