All Projects → koki → Json

koki / Json

Licence: bsd-3-clause
Fork of golang's encoding/json: now with more validation and error context

Programming Languages

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

Labels

Projects that are alternatives of or similar to Json

Jos.contentserializer
Library that converts any Episerver ContentData object to JSON
Stars: ✭ 29 (-17.14%)
Mutual labels:  json
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-8.57%)
Mutual labels:  json
Node Quick Mock
🌞 基于Express的mock接口平台
Stars: ✭ 33 (-5.71%)
Mutual labels:  json
Json Indonesia Holidays
Json hari libur indonesia yang slalu update.
Stars: ✭ 30 (-14.29%)
Mutual labels:  json
Jsonpath Rs
JSONPath for Rust
Stars: ✭ 31 (-11.43%)
Mutual labels:  json
Parson
Lightweight JSON library written in C.
Stars: ✭ 965 (+2657.14%)
Mutual labels:  json
Facebook page group comments
Facebook Page and Group's Post Scraper is a script for gathering data using Facebook's Graph API
Stars: ✭ 29 (-17.14%)
Mutual labels:  json
Realtime Newsapi
Financial News Aggregator - Real Time & Query API for Financial News
Stars: ✭ 34 (-2.86%)
Mutual labels:  json
Borealis Server Manager
Utility designed to facilitate the deployment, management, and control of various kinds of dedicated gameservers.
Stars: ✭ 31 (-11.43%)
Mutual labels:  json
Jsontocodable
A generating tool from Raw JSON to Codable (Swift4) text written in Swift4.
Stars: ✭ 33 (-5.71%)
Mutual labels:  json
Ios Category
iOS 工具分类整理
Stars: ✭ 30 (-14.29%)
Mutual labels:  json
Apicache
Simple API-caching middleware for Express/Node.
Stars: ✭ 957 (+2634.29%)
Mutual labels:  json
Jc
CLI tool and python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
Stars: ✭ 967 (+2662.86%)
Mutual labels:  json
Evreflection
Reflection based (Dictionary, CKRecord, NSManagedObject, Realm, JSON and XML) object mapping with extensions for Alamofire and Moya with RxSwift or ReactiveSwift
Stars: ✭ 954 (+2625.71%)
Mutual labels:  json
Lift
Lift is a Swift library for generating and extracting values into and out of JSON-like data structures.
Stars: ✭ 33 (-5.71%)
Mutual labels:  json
Jplot
iTerm2 expvar/JSON monitoring tool
Stars: ✭ 949 (+2611.43%)
Mutual labels:  json
Python Pixabay
Python 3 Pixabay's API wrapper.
Stars: ✭ 32 (-8.57%)
Mutual labels:  json
Awesome Json
A curated list of awesome JSON libraries and resources.
Stars: ✭ 973 (+2680%)
Mutual labels:  json
News Please
news-please - an integrated web crawler and information extractor for news that just works.
Stars: ✭ 969 (+2668.57%)
Mutual labels:  json
Data Forge Ts
The JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.
Stars: ✭ 967 (+2662.86%)
Mutual labels:  json

Koki's JSON library

It's a fork that makes encoding/json better for users.

Features

  • Annotates decoder errors with the path (e.g. $.pod.container.0.env) where the error occurred. The golang built-in implementation doesn't contextualize errors, so it's hard to track down where they came from.

  • Check for extraneous fields in your JSON, which is useful for detecting misspelled keys and other typos.

  • omitempty actually omits zero-valued structs.

How to use it

github.com/koki/json is a drop-in replacement for encoding/json. The decoder implementation is different, but the library API remains unchanged. Use this package's json.Unmarshal if you want paths for your decoder errors. Use json.Marshal if you want to omit zero-valued structs.

// Deserialize
foo := Foo{}
err := json.Unmarshal(data, &foo)
...

// Serialize
bar := Bar{}
data, err := json.Marshal(bar)
...

github.com/koki/json/jsonutil is a brand-new package. Use jsonutil.ExtraneousFieldPaths to get a list of paths that weren't decoded into your Go object. i.e. potential typos.

// 1. Parse.
obj := make(map[string]interface{})
parsedObj := Foo{}
err := json.Unmarshal(data, &obj)
...
err = jsonutil.UnmarshalMap(obj, &parsedObj)
...

// 2. Check for unparsed fields--potential typos.
extraneousPaths, err := jsonutil.ExtraneousFieldPaths(obj, parsedObj)
...
if len(extraneousPaths) > 0 {
    return nil, &jsonutil.ExtraneousFieldsError{Paths: extraneousPaths}
}
...
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].