回答編集履歴
1
説明文の軽微変更
answer
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
JSONをPythonで
|
1
|
+
JSONをPythonで扱うにはその名もズバリ [jsonモジュール](https://docs.python.jp/3/library/json.html) を使います。
|
2
2
|
|
3
|
+
json.loads() でJSON形式の文字列をPythonの辞書オブジェクトに変換できます。
|
4
|
+
|
3
5
|
```python
|
4
6
|
import json
|
5
7
|
|
@@ -13,14 +15,14 @@
|
|
13
15
|
}""")
|
14
16
|
```
|
15
17
|
|
16
|
-
|
18
|
+
あとは辞書の目的のキーにアクセスしてください。
|
17
19
|
|
18
20
|
```python
|
19
21
|
>>> print(j['business_id'])
|
20
22
|
encrypted business id
|
21
23
|
```
|
22
24
|
|
23
|
-
Pythonでリストを作
|
25
|
+
また、Pythonでリストオブジェクトを作るには "[]" 記号の中にオブジェクトをカンマ区切りで記述します。
|
24
26
|
|
25
27
|
```python
|
26
28
|
l = ['apple', 'orange', 'lemon']
|