sách gpt4 ai đã đi

json - Giá trị JSON có phải là JSON hợp lệ không?

In lại 作者:行者123 更新时间:2023-12-04 02:13:00 30 4
mua khóa gpt4 Nike

JSON 值字符串、数字、true、false、null 是否是有效的 JSON?
即,是

ĐÚNG VẬY

一个有效的 JSON 文档?还是必须是数组/对象?

一些验证器接受这个(例如 http://jsonlint.com/ ),而其他验证器不接受(例如 http://jsonschemalint.com/ )。 RFC 和 json.org 在这个问题上并不清楚。

1 Câu trả lời

截至 2014 年 3 月:Đúng . From the specification :

A JSON text is a serialized value. Note that certain previous specifications of JSON constrained a JSON text to be an object or an array. Implementations that generate only objects or arrays where a JSON text is called for will be interoperable in the sense that all implementations will accept these as conforming JSON texts.



然而, 当时最初问这个问题 ,答案是:否。 The original specification said :

A JSON text is a serialized object or array



因此,JSON 文本中最外层的数据类型必须是对象或数组,不能是字符串、 bool 值、数字或任何其他数据类型。

关于json - JSON 值是有效的 JSON 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15205925/

30 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com