Skip to content

Commit c96c165

Browse files
committed
Add GitHub Pages landing page
1 parent 0058bdf commit c96c165

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

index.html

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>java.util.json Backport for JDK 21+</title>
7+
<style>
8+
body {
9+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
10+
line-height: 1.6;
11+
color: #333;
12+
max-width: 900px;
13+
margin: 0 auto;
14+
padding: 20px;
15+
background-color: #f5f5f5;
16+
}
17+
.container {
18+
background-color: white;
19+
padding: 30px;
20+
border-radius: 8px;
21+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
22+
}
23+
h1, h2, h3 {
24+
color: #2c3e50;
25+
}
26+
h1 {
27+
border-bottom: 3px solid #3498db;
28+
padding-bottom: 10px;
29+
}
30+
pre {
31+
background-color: #f4f4f4;
32+
border: 1px solid #ddd;
33+
border-radius: 4px;
34+
padding: 15px;
35+
overflow-x: auto;
36+
}
37+
code {
38+
background-color: #f4f4f4;
39+
padding: 2px 4px;
40+
border-radius: 3px;
41+
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
42+
}
43+
.highlight {
44+
background-color: #fff3cd;
45+
border-left: 4px solid #ffc107;
46+
padding: 10px;
47+
margin: 15px 0;
48+
}
49+
.button {
50+
display: inline-block;
51+
padding: 10px 20px;
52+
background-color: #3498db;
53+
color: white;
54+
text-decoration: none;
55+
border-radius: 5px;
56+
margin-right: 10px;
57+
margin-top: 10px;
58+
}
59+
.button:hover {
60+
background-color: #2980b9;
61+
}
62+
.button.secondary {
63+
background-color: #95a5a6;
64+
}
65+
.button.secondary:hover {
66+
background-color: #7f8c8d;
67+
}
68+
.nav {
69+
background-color: #34495e;
70+
padding: 15px;
71+
border-radius: 5px;
72+
margin-bottom: 20px;
73+
}
74+
.nav a {
75+
color: white;
76+
text-decoration: none;
77+
margin-right: 20px;
78+
}
79+
.nav a:hover {
80+
text-decoration: underline;
81+
}
82+
</style>
83+
</head>
84+
<body>
85+
<div class="container">
86+
<h1>java.util.json Backport for JDK 21+</h1>
87+
88+
<div class="nav">
89+
<a href="https://github.com/simbo1905/java.util.json.Java21">GitHub Repository</a>
90+
<a href="https://github.com/simbo1905/java.util.json.Java21/wiki">Wiki</a>
91+
<a href="Towards%20a%20JSON%20API%20for%20the%20JDK.pdf">Original Proposal (PDF)</a>
92+
<a href="https://github.com/openjdk/jdk-sandbox/tree/json">OpenJDK Sandbox</a>
93+
</div>
94+
95+
<div class="highlight">
96+
<strong>Early Access:</strong> This is an unofficial backport of the experimental <code>java.util.json</code> API from OpenJDK sandbox,
97+
enabling developers to use future JSON API patterns today on JDK 21+.
98+
</div>
99+
100+
<h2>Quick Start</h2>
101+
102+
<h3>Maven Dependency</h3>
103+
<pre><code>&lt;dependency&gt;
104+
&lt;groupId&gt;jdk-sandbox&lt;/groupId&gt;
105+
&lt;artifactId&gt;json-experimental&lt;/artifactId&gt;
106+
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
107+
&lt;/dependency&gt;</code></pre>
108+
109+
<h3>Simple Example</h3>
110+
<pre><code>import jdk.sandbox.java.util.json.*;
111+
112+
// Parse JSON
113+
JsonValue value = Json.parse("{\"name\":\"Alice\",\"age\":30}");
114+
JsonObject obj = (JsonObject) value;
115+
116+
// Access values
117+
String name = ((JsonString) obj.members().get("name")).value();
118+
int age = ((JsonNumber) obj.members().get("age")).toNumber().intValue();</code></pre>
119+
120+
<h2>Key Features</h2>
121+
<ul>
122+
<li><strong>Future-Compatible API:</strong> Write code today that will work with tomorrow's official <code>java.util.json</code></li>
123+
<li><strong>Sealed Type Hierarchy:</strong> Type-safe JSON values using Java's sealed classes</li>
124+
<li><strong>Record Integration:</strong> Seamless mapping between Java records and JSON</li>
125+
<li><strong>Pattern Matching:</strong> Leverage modern Java features for elegant JSON handling</li>
126+
<li><strong>Immutable Values:</strong> Thread-safe by design</li>
127+
</ul>
128+
129+
<h2>Record Mapping Example</h2>
130+
<pre><code>// Domain model
131+
record User(String name, String email, boolean active) {}
132+
record Team(String teamName, List&lt;User&gt; members) {}
133+
134+
// Convert to JSON
135+
Team team = new Team("Engineering", List.of(
136+
new User("Alice", "[email protected]", true),
137+
new User("Bob", "[email protected]", false)
138+
));
139+
140+
JsonValue teamJson = Json.fromUntyped(Map.of(
141+
"teamName", team.teamName(),
142+
"members", team.members().stream()
143+
.map(u -> Map.of(
144+
"name", u.name(),
145+
"email", u.email(),
146+
"active", u.active()
147+
))
148+
.toList()
149+
));</code></pre>
150+
151+
<h2>Resources</h2>
152+
<a href="https://github.com/simbo1905/java.util.json.Java21" class="button">View on GitHub</a>
153+
<a href="https://github.com/simbo1905/java.util.json.Java21/wiki" class="button secondary">Documentation Wiki</a>
154+
<a href="Towards%20a%20JSON%20API%20for%20the%20JDK.pdf" class="button secondary">Original Proposal</a>
155+
156+
<h2>Status</h2>
157+
<p>This backport is based on OpenJDK sandbox commit <a href="https://github.com/openjdk/jdk-sandbox/commit/d22dc2ba89789041c3908cdaafadc1dcf8882ebf">d22dc2ba8</a>
158+
(July 2025). The API may evolve as the official specification develops.</p>
159+
160+
<h2>License</h2>
161+
<p>Licensed under the GNU General Public License version 2 with Classpath exception,
162+
same as the OpenJDK project.</p>
163+
</div>
164+
</body>
165+
</html>

0 commit comments

Comments
 (0)