jsondata.__init__¶
The data represented as in-memory ‘json’ compatible structure, with dynamically added and/or removed branches. The components are:
- JSONData: The main class JSONData provides for the core interface.
- JSONDataSerializer: Derived from JSONData provides for serialization and integration of documents and sub-documents.
- JSONPointer: The JSONPointer module provides for addressing in accordance to RCF7159 and RFC6901.
- JSONPatch: The JSONPatch module provides features in accordance to RFC6902.
- JSONDiff: Structure utilities.
Module¶
Modular processing of JSON data by trees and branches, pointers and patches.
Constants¶
Assigment Types¶
- C_REF(0) - OP-Copy: Copy reference.
- C_DEEP(1) - OP-Copy: Copy deep.
- C_SHALLOW(2) - OP-Copy: Copy shallow.
Branch-Operations Types¶
- B_ALL(0) - OP-On-Branches: in any case.
- B_AND(1) - OP-On-Branches: only when both present.
- B_OR(2) - OP-On-Branches: if one is present.
- B_XOR(3) - OP-On-Branches: if only one is present.
- B_MOD(4) - OP-On-Branches: modulo of branches.
- B_SUB(5) - OP-On-Branches: subtract branches.
- B_MULT(6) - OP-On-Branches: add a pattern to the whole tree.
- B_DIV(7) - OP-On-Branches: remove a pattern from the whole tree.
Character Display¶
- CHARS_RAW(0) - display character set as raw
- CHARS_STR(1) - display character set as str
- CHARS_UTF(2) - display character set as utf
Data Scopes¶
- SD_BOTH(0) - Apply on mixed input and output data.
- SD_INPUT(1) - Apply on input data.
- SD_OUTPUT(2) - Apply on output data.
Display Style¶
- PT_PATH(0) - Displays a list of items.
- PT_RFC6901(1) - Displays rfc6901 strings.
- PT_NODE(2) - Displays the node.
Line Handling of Overflow¶
- LINE_CUT(0) - force line fit
- LINE_WRAP(1) - wrap line in order to fit to length
Modes¶
Data¶
- MJ_RFC4627(1) - The first JSON RFC by July 2006 [RFC4627].
- MJ_RFC7493(2) - The iJSON RFC - for now same as RFC7159 [RFC7493].
- MJ_RFC7159(2) - The JSON RFC by ‘now’, by March 2014 [RFC7159].
- MJ_RFC8259(4) - The JSON RFC by December 2017 [RFC8259].
- MJ_ECMA264(16) - The first JSON EMCMA standard [ECMA264].
- MJ_RFC6901(32) - JSONPointer first IETF RFC [RFC6901].
- MJ_RELPOINTER(64) - JSONPointer - relative pointer Draft-01 January 2018 [RELPOINTER].
- MJ_RFC6902(128) - JSONPatch first IETF RFC [RFC6902].
Match Criteria¶
Match criteria for node comparison.
- MATCH_INSERT(0) - For dicts.
- MATCH_NO(1) - Negates the whole set.
- MATCH_KEY(2) - For dicts.
- MATCH_CHLDATTR(3) - For dicts and lists.
- MATCH_INDEX(4) - For lists.
- MATCH_MEM(5) - For dicts(value) and lists.
- MATCH_NEW(6) - If not present create a new, else ignore and keep present untouched.
- MATCH_PRESENT(7) - Check all are present, else fails.
Match Sets¶
Defines the returned sets of matches.
- M_FIRST(1) - The first match only.
- M_LAST(2) - The last match only.
- M_ALL(4) - All matches.
JSON Notation¶
Notation of the API - in/out.
- NOTATION_NATIVE(0) - JSON notation in accordance to RFC7159. This is the default.
- NOTATION_JSON(1) - JSON notation in accordance to RFC7159 with RFC3986.
- NOTATION_JSON_REL(2) - JSON notation as relative pointer.
- NOTATION_HTTP_FRAGMENT(1) - JSON notation in accordance to RFC7159 with RFC3986.
Operator Scopes¶
- SC_DATA(0) - OP-Scope: the managed JSON data only.
- SC_SCHEMA(1) - OP-Scope: the managed JSON schema only.
- SC_JSON(2) - OP-Scope: the managed JSON data and schema only.
- SC_OBJ(3) - OP-Scope: the attributes of current instance.
- SC_ALL(4) - OP-Scope: the complete object, including data.
- C_DEFAULT = C_REF - Default value.
Pointer Display¶
- PT_PATH = 0
- PT_RFC6901 = 1
Print Formats¶
- DF_SUMUP = 0 - short list
- DF_CSV = 1 - csv, for now semicolon only
- DF_JSON = 3 - JSON struture
- DF_TABLE = 4 - table, for now fixed
- DF_REVIEW = 5 - short for quick review
- DF_REPR = 6 - repr() - raw string, Python syntax
- DF_STR = 7 - str() - formatted string, Python syntax
Return Types¶
- R_OBJ(0) - Return object of type self.
- R_DATA(1) - Return self.data.
- R_JDATA(2) 0 Return object of type JSONData.
Search Parameters¶
- SEARCH_FIRST(0) - Break display after first match.
- SEARCH_ALL(1) - List all matches.
Sort Order¶
- S_NONE = 0 - no sort
- S_SIMPLE = 1 - goups upper lower