adafruit / adafruit/Adafruit_CircuitPython_JSON_Stream
A value of null is not understood
- 主要言語
- Python
- スター
- 2
- フォーク
- 7
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
next_value から始め、提供された io.BytesIO の例で問題を再現し、[1,2,null,3,4] に対する反復を比較します。JSON null の項目が None として返され、残りの値について反復が継続すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 50/100