Skip to content
David edited this page Dec 1, 2022 · 5 revisions

Yet another python library to safely work with json data. It implements many useful features such as default values, type casting and safe indexing.

Overview of important methods

you... know that key/index exists know the type want a default value want a certain type, but don't care about the actual type Use Case
ensure X you don't really know the data, but want to have a default value
ensureCast X X chaining
optionalGet X you want to handle deviating data (extens dict.get() with a type)
optionalCast X you want to handle non-existing keys, but don't care about deviating types
assertGet X X you know the data

Comparison of return values

key exists, type correct key exists, type wrong key doesn't exist
ensure value default default
ensureCast value value default
optionalGet value None None
optionalCast value value None
assertGet value AssertionError AssertionError
Clone this wiki locally