質問編集履歴

2

質問後に実施したこと。

2022/11/15 08:08

投稿

sasaki0628
sasaki0628

スコア106

test CHANGED
File without changes
test CHANGED
@@ -42,3 +42,27 @@
42
42
  j2p_data = json.loads(request.data[0])  
43
43
 
44
44
  を試しましたが、同じエラーメッセージが出力されました。
45
+
46
+ 型がよくないのかと思い、
47
+
48
+ data = str(request.data)
49
+ j2p_data = json.loads(data)
50
+
51
+ に修正したところ、以下のエラーメッセージが出力されました。
52
+
53
+ **Exception Type: JSONDecodeError
54
+ Exception Value:
55
+ Expecting property name enclosed in double quotes: line 1 column 2 (char 1)**
56
+
57
+ axios.postで送信したdataのカラムにダブルクオーテーションがついていなかったため、すべてつけたところ、以下のエラーメッセージに変わりました。
58
+
59
+ **Exception Type: TypeError
60
+ Exception Value:
61
+ the JSON object must be str, bytes or bytearray, not dict**
62
+
63
+
64
+ data = str(request.data)がおかしいかと思い、data = request.data に戻しました。以下のエラーメッセージに戻りました。
65
+
66
+ **Exception Type: JSONDecodeError
67
+ Exception Value:
68
+ Expecting property name enclosed in double quotes: line 1 column 2 (char 1)**

1

質問後にしたこと

2022/11/15 07:52

投稿

sasaki0628
sasaki0628

スコア106

test CHANGED
File without changes
test CHANGED
@@ -35,5 +35,10 @@
35
35
  Exception Value:
36
36
  the JSON object must be str, bytes or bytearray, not dict**
37
37
 
38
+ j2p_data = json.loads(request.data) の部分をどのようにして修正すればよいでしょうか。
38
39
 
40
+ ▽追記 
41
+ j2p_data = json.loads(request)  
39
- j2p_data = json.loads(request.data) の部分をどのようにして修正すればよいでしょうか。
42
+ j2p_data = json.loads(request.data[0])  
43
+
44
+ を試しましたが、同じエラーメッセージが出力されました。