nob: the Nested OBject manipulator¶
Nested Objects (nobs, often referred to simply as JSON objects) appear in many software workflows. They are combinations of key-value mappings (dicts) and sequences (lists) of data. Other, more human readable formats than JSON are useful to view this type of data, such as YAML:
shelters:
kennel:
dogs:
- name: Rex
age: 3
alpha: False
- name: Beethoven
age: 8
alpha: True
Their manipulation can become cumbersome in pure Python, in proportion to the complexity of their structure. With nob, accessing the first dog’s name is done with either of:
first = n['dogs'][0]['name'][:]
first = n.dogs[0].name[:]
and finding the alpha dog’s name with:
alpha = [nv for nv in n.dogs if nv.alpha[:]][0].name[:]
The industry standard to deal with nobs is known as Object Relational Mapping
(ORMs). In ORMs, Python objects are defined in code to hold the nob data as
attributes. This is a great abstraction, but in some cases nobs can have
complex, uncertain structure, and it can be very difficult to build and ORM for
them. Or, you just don’t want to deal with building an ORM. This is where
nob
comes in.
nob
is a wrapper for nested objects that offers a set of functionalities to
simplify their direct manipulation. In doing so, it strives to stay as close as
possible to native python datatype interfaces, and to be intuitive for
developers with Python habits.
User’s Guide¶
nob
is meant to be intuitive, but there are some ideas you must have about
the underlying data model in order to not be surprised by its behaviour. This
part explores these ideas in both general and concrete form.
API Reference¶
You can dive into the specific functions of nob
here.
Additional Notes¶
Miscellaneous information about the project.
- How to contribute to NOB
- Licence
- Changelog
- [0.8.0] - 2022-06-28
- [0.7.0] - 2022-03-09
- [0.6.1] - 2021-09-23
- [0.6.0] - 2021-09-10
- [0.5.6] - 2021-09-10
- [0.5.5] - 2020-12-10
- [0.5.4] - 2020-08-31
- [0.5.0] - 2020-08-31
- [0.4.1] - 2020-02-13
- [0.4.0] - 2020-02-05
- [0.3.2] - 2020-02-05
- [0.3.1] - 2020-01-31
- [0.3.0] - 2020-01-31
- [0.2.1] - 2019-08-26
- [0.2.0] - 2019-08-23