[Paper Review] JSON: data model, query languages and schema specification
This paper proposes a formal data model for JSON, a lightweight navigational query language (JNL), and a logical schema specification (JSL) for JSON documents. It establishes theoretical foundations for querying and validating JSON, showing that evaluation is PTIME-complete and satisfiability is EXPTIME-complete, offering a rigorous framework for practical systems like MongoDB and JSON Schema.
Despite the fact that JSON is currently one of the most popular formats for exchanging data on the Web, there are very few studies on this topic and there are no agreement upon theoretical framework for dealing with JSON. There- fore in this paper we propose a formal data model for JSON documents and, based on the common features present in available systems using JSON, we define a lightweight query language allowing us to navigate through JSON documents. We also introduce a logic capturing the schema proposal for JSON and study the complexity of basic computational tasks associated with these two formalisms.
Motivation & Objective
- To establish a formal data model for JSON that captures its tree-structured, deterministic, and compositional nature.
- To define a lightweight, navigational query language (JNL) based on common features in real-world JSON systems like MongoDB and Python.
- To introduce a logical formalism (JSL) that captures the full semantics of JSON Schema, including recursive and unique key constraints.
- To analyze the computational complexity of core tasks—evaluation and satisfiability—for both JNL and JSL.
- To identify open problems in streaming, projection, and API documentation for future research.
Proposed method
- Define a formal JSON data model as a deterministic, ordered tree with objects, arrays, and atomic values, where keys are unique and values can be nested JSON structures.
- Design a navigational query language (JNL) inspired by XPath and PDL, supporting path expressions, equality on subtrees, and navigation through keys and array indices.
- Introduce a logic (JSL) for specifying JSON schemas, including constraints on key uniqueness, value types, and recursive structure.
- Prove that JNL evaluation is PTIME-complete in combined complexity using a bottom-up, stratified evaluation algorithm.
- Show that JSL satisfiability is in 2Exptime and EXPTIME-complete without the Unique predicate, using a specialized tree automaton model.
- Use reductions and automata-theoretic techniques to relate JSL to known formalisms, while accounting for JSON-specific features like subtree equality and deterministic keys.
Experimental results
Research questions
- RQ1What is a formal, mathematically sound data model for JSON that reflects its practical use in web APIs and NoSQL databases?
- RQ2Which core querying features are consistently present across real JSON systems, and how can they be formalized into a lightweight, efficient query language?
- RQ3How can the full semantics of JSON Schema, including recursive types and unique key constraints, be captured in a logical formalism?
- RQ4What is the computational complexity of evaluating queries and checking schema satisfiability in the proposed formalisms?
- RQ5What are the key challenges and open problems in extending the formal framework to streaming, projection, and API documentation?
Key findings
- The evaluation problem for recursive JSL expressions over JSON trees is PTIME-complete in combined complexity, indicating efficient evaluation is feasible.
- The satisfiability problem for recursive JSL expressions is in 2Exptime and EXPTIME-complete when the Unique predicate is excluded, showing high but bounded complexity.
- The proposed JNL language captures common query patterns in systems like MongoDB and Python, and supports efficient bottom-up evaluation using a stratified algorithm.
- The formalism shows that JSON’s deterministic key structure and subtree equality introduce new challenges compared to XML, requiring refined analysis techniques.
- The logic JSL is shown to be equivalent in expressive power to the navigational query language JNL, suggesting a duality between querying and schema specification.
- The paper identifies that streaming evaluation of JNL and JSL may be possible with constant memory if subtree equality is excluded, opening a path for real-time processing.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.