JSON Schema
A vocabulary for annotating and validating the structure, types, and constraints of JSON documents.
技术细节
JSON Schema is defined by RFC 8259 and ECMA-404. It supports six data types: string, number, object, array, boolean, and null. JSON numbers have no distinction between integer and float — implementations must handle precision carefully (JavaScript's Number.MAX_SAFE_INTEGER is 2^53 - 1). JSON does not support comments, trailing commas, or single quotes, which are common sources of parse errors. JSON5 and JSONC extend the format with these developer-friendly features.
示例
```javascript
// Parse JSON with error handling
try {
const data = JSON.parse(rawString);
console.log(data.name); // access properties
} catch (e) {
console.error('Invalid JSON:', e.message);
}
// Serialize with formatting
const pretty = JSON.stringify(obj, null, 2);
```
相关格式
相关工具
H
Hash Generator
M
Mock JSON 生成器
P
Password Generator
U
Unix 时间戳转换器
C
Cron 表达式生成器
C
Chmod 计算器
J
JSON 格式化
S
String Escape / Unescape
I
IP Subnet Calculator
C
Color Code Converter
C
CSV ↔ JSON Converter
X
XML ↔ JSON Converter
S
SQL Formatter
M
Markdown Table Generator
H
HTTP Status Code Reference
M
Meta Tags Generator
R
Robots.txt Generator
.
.gitignore Generator
H
HTML Formatter
C
CSS Unit Converter
J
JSONPath Evaluator
T
Text Diff Checker
D
Data URI Converter
L
Lorem Ipsum Generator
P
Path Converter
.
.htaccess Generator
.
.env Validator
P
Placeholder Image Generator