adafruit / adafruit/Adafruit_CircuitPython_JSON_Stream
A value of null is not understood
- Ngôn ngữ chính
- Python
- Star
- 2
- Fork
- 7
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
In json "null" is a valid value for an item in a list or object. `json.loads("null")` returns `None`.
Because `next_value` returns `json.loads(value_string)` or `None` (or a Transient subclass), and that value is compared to `None`, a list like [1,2,null,3,4,5] is wrongly interpreted.
Here is a comparison with `json_stream` too.
```py
import adafruit_json_stream
import json_stream
import io
def test_null_item(json_stream):
print("-"*10)
source = io.BytesIO(b'[1,2,null,3,4]')
stream = json_stream.load(source)
for item in stream:
print("-", item)
test_null_item(adafruit_json_stream)
test_null_item(json_stream)
```
```
----------
- 1
- 2
----------
- 1
- 2
- None
- 3
- 4
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu tại next_value và tái hiện vấn đề bằng ví dụ io.BytesIO được cung cấp, so sánh việc lặp qua [1,2,null,3,4]. Hoàn thành khi một mục JSON null được trả về dưới dạng None và việc lặp tiếp tục qua các giá trị còn lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 50/100