Generated by GPT-5-mini| javax.json | |
|---|---|
| Name | javax.json |
| Developer | Oracle Corporation; Eclipse Foundation contributors |
| Initial release | 2013 |
| Latest release | 1.1 (specification maintained by Eclipse Foundation) |
| Programming language | Java (programming language) |
| Operating system | Cross-platform |
| License | CDDL and GPL dual-licensed for reference implementations; specification allows multiple licenses |
javax.json is a Java API specification for processing, generating, transforming, and querying JSON (JavaScript Object Notation) documents. The specification provides a standardized set of interfaces and object models intended to interoperate with the Java Platform, Standard Edition ecosystem, enabling frameworks and libraries to parse, build, stream, and bind JSON structures in server-side and client-side Java applications. It influenced and integrated with Java Enterprise technologies and spurred multiple independent implementations and utility libraries across the OpenJDK and Eclipse Foundation communities.
The specification originated during a period of growing JSON adoption alongside technologies such as AJAX, REST, and JSON-RPC, prompting standards activity within the Java community. Early efforts aligned with initiatives from Oracle Corporation and contributors from the GlassFish project; formal work coordinated through javax.* namespaces and community-driven JSR-style processes. The release coincided with similar specification efforts like JAX-RS and JAXB modernization, and later stewardship moved toward the Eclipse Foundation where related projects such as Eclipse GlassFish and other JSON-related tooling continued evolution. Industry adoption intersected with vendors including Red Hat, IBM, Oracle Corporation, Payara, Tomitribe, and Apache Software Foundation projects that integrated the API into middleware, application servers, and microservice stacks.
The API defines two complementary programming models: an object model and a streaming model, echoing designs from Jackson (software), GSON, and streaming APIs from StAX and SAX. Core interfaces include reader and writer factories influenced by patterns in JAXP and JSR 353 heritage, with types such as JSON readers, JSON writers, JSON parsers, JSON generators, JsonObject, JsonArray, JsonValue, and builders patterned after builder idioms found in Guava and Apache Commons. Factories and providers leverage service provider mechanisms akin to ServiceLoader in OpenJDK and configuration approaches used by Hibernate and Spring Framework. Integration points reference concepts used by JDBC connection factories and JMS session factories for creating and managing parser/generator lifecycles. Exception hierarchies and validation semantics reflect designs comparable to those in JAX-RS and validation frameworks such as Bean Validation.
Typical usage demonstrates creating a JsonObject using builder idioms familiar to users of JSF component builders and producing output via streaming generators like those in StAX implementations. Common patterns show parsing payloads from HTTP requests handled by Servlet containers such as Apache Tomcat or Jetty, and marshalling responses for clients used by Android or JavaFX desktop applications. Example operations include reading nested structures produced by APIs following specifications similar to OpenAPI Specification endpoints, constructing objects for persistence to NoSQL stores like MongoDB or for transmission to messaging systems like Apache Kafka and RabbitMQ, and transforming documents in pipelines inspired by Apache Camel routes. The API also supports streaming large documents without materializing full trees, which is important in environments hosted on platforms such as Amazon Web Services and Google Cloud Platform.
Multiple implementations arose to satisfy the specification, including reference and community-driven projects maintained by organizations such as Oracle Corporation, GlassFish community contributors, Eclipse Foundation projects, and third-party vendors like Yasson and others influenced by ecosystems around Jakarta EE, MicroProfile, and server runtimes from WildFly and Payara Server. Compatibility matrices addressed integration with Java SE versions, transitions to the Jakarta EE namespace, and interoperability with libraries like Jackson (software) and EclipseLink for JSON-B binding. Packaging and module descriptors were adapted to JPMS and OSGi environments common in enterprise distributions from Red Hat and IBM.
Performance profiles compare the memory and throughput characteristics of the object model versus streaming model, with benchmarks often referencing tooling from JMH and continuous integration systems used by vendors like Travis CI and Jenkins. Streaming parsers minimize garbage creation, which matters for latency-sensitive services deployed on platforms such as Kubernetes and Docker. Security considerations include defenses against malformed input, protection from entity expansion or recursive structures referenced in advisories issued by vendors including Oracle Corporation and Red Hat, secure handling of character encodings as guided by IETF standards, and safe default behaviors for numeric precision to mitigate interoperability bugs reported in large-scale systems like those managed by Netflix and LinkedIn. Best practices align with recommendations from OWASP for preventing injection attacks and ensuring safe logging and exception handling.
Adoption spans Java web frameworks, application servers, microprofile ecosystems, and cloud-native toolchains. Projects and organizations integrating the API include Apache Tomcat, Eclipse GlassFish, WildFly, Payara, Spring Framework-based applications, Quarkus extensions, and tooling from Maven and Gradle. The ecosystem includes adapters and converters for popular persistence solutions like Hibernate, connectors for messaging platforms such as Apache Kafka and ActiveMQ, and developer tooling in IDEs like Eclipse (software), IntelliJ IDEA, and NetBeans. Continued maintenance and community engagement occur through mailing lists, issue trackers, and contribution workflows hosted by foundations and vendors, ensuring the API remains relevant alongside evolving standards in the Java Platform, Standard Edition and cloud-native landscapes.
Category:Java APIs