質問編集履歴

1

追記

2020/01/24 08:43

投稿

chiba_kun
chiba_kun

スコア16

test CHANGED
File without changes
test CHANGED
@@ -191,3 +191,49 @@
191
191
 
192
192
 
193
193
  ※また質問文の中で、質問とは直接関係はないが、用語の使い方を間違えていたり、何か大きな勘違いをしている節があれば、それらについて指摘などをしてくださると、成長に繋がるので指摘していただけると幸いです。
194
+
195
+
196
+
197
+
198
+
199
+ ### 追記
200
+
201
+
202
+
203
+ 回答の通りjsonをJSON.parseしてオブジェクトに変換してみることに。結果は上手くいきませんでした。
204
+
205
+ ダブルクオーテーションが外れていないので、parseが出来なていないんですかね、、、?。?
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+ ```実行したコード
214
+
215
+ function callback(error, responsedayo, body) {
216
+
217
+
218
+
219
+ if (!error && responsedayo.statusCode == 200) {
220
+
221
+ const obj = JSON.parse(body);
222
+
223
+ response.send(obj);
224
+
225
+ }
226
+
227
+ }
228
+
229
+ ```
230
+
231
+ ```json.parseしたオブジェクトをブラウザに出力。
232
+
233
+ {"request_id":"1579854042,cf2754ce-7371-4deb-99ed-7142ce917daa","time_used":920,"faces":[{"face_token":"79536e36c0c38ef8046cd789e60b2041","face_rectangle":{"top":421,"left":723,"width":409,"height":409},"landmark":{"contour_chin":{"x":989,"y":811},"contour_left1":{"x":694,"y":557},"contour_left2":{"x":710,"y":601},"contour_left3":{"x":730,"y":642},"contour_left4":{"x":752,"y":683},"contour_left5":{"x":777,"y":722},"contour_left6":{"x":808,"y":757},"contour_left7":{"x":846,"y":784},"contour_left8":{"x":888,"y":805},"contour_left9":{"x":936,"y":817},"contour_right1":{"x":1090,"y":452},"contour_right2":{"x":1098,"y":496},"contour_right3":{"x":1102,"y":540},"contour_right4":{"x":1102,"y":584},"contour_right5":{"x":1099,"y":628},"contour_right6":{"x":1091,"y":672},"contour_right7":{"x":1078,"y":713},"contour_right8":{"x":1059,"y":753},"contour_right9":{"x":1032,"y":788},"left_eye_bottom":{"x":820,"y":533},"left_eye_center":{"x":818,"y":522},"left_eye_left_corner":{"x":780,"y":529},"left_eye_lower_left_quarter":{"x":799,"y":534},"left_eye_lower_right_quarter":{"x":839,"y":527},"left_eye_pupil":{"x":825,"y":518},"left_eye_right_corner":{"x":855,"y":517},"left_eye_top":{"x":816,"y":508},"left_eye_upper_left_quarter":{"x":796,"y":516},"left_eye_upper_right_quarter":{"x":838,"y":507},"left_eyebrow_left_corner":{"x":724,"y":504},"left_eyebrow_lower_left_quarter":{"x":754,"y":496},"left_eyebrow_lower_middle":{"x":785,"y":486},"left_eyebrow_lower_right_quarter":{"x":817,"y":479},"left_eyebrow_right_corner":{"x":850,"y":468},"left_eyebrow_upper_left_quarter":{"x":748,"y":479},"left_eyebrow_upper_middle":{"x":781,"y":466},"left_eyebrow_upper_right_quarter":{"x":816,"y":461},"mouth_left_corner":{"x":895,"y":734},"mouth_lower_lip_bottom":{"x":971,"y":755},"mouth_lower_lip_left_contour1":{"x":930,"y":729},"mouth_lower_lip_left_contour2":{"x":917,"y":748},"mouth_lower_lip_left_contour3":{"x":941,"y":757},"mouth_lower_lip_right_contour1":{"x":992,"y":713},"mouth_lower_lip_right_contour2":{"x":1012,"y":722},"mouth_lower_lip_right_contour3":{"x":996,"y":742},"mouth_lower_lip_top":{"x":963,"y":724},"mouth_right_corner":{"x":1023,"y":700},"mouth_upper_lip_bottom":{"x":961,"y":721},"mouth_upper_lip_left_contour1":{"x":939,"y":703},"mouth_upper_lip_left_contour2":{"x":916,"y":718},"mouth_upper_lip_left_contour3":{"x":929,"y":727},"mouth_upper_lip_right_contour1":{"x":972,"y":694},"mouth_upper_lip_right_contour2":{"x":998,"y":696},"mouth_upper_lip_right_contour3":{"x":991,"y":711},"mouth_upper_lip_top":{"x":957,"y":703},"nose_contour_left1":{"x":877,"y":516},"nose_contour_left2":{"x":888,"y":610},"nose_contour_left3":{"x":910,"y":651},"nose_contour_lower_middle":{"x":938,"y":652},"nose_contour_right1":{"x":932,"y":503},"nose_contour_right2":{"x":965,"y":592},"nose_contour_right3":{"x":963,"y":639},"nose_left":{"x":884,"y":646},"nose_right":{"x":984,"y":622},"nose_tip":{"x":933,"y":619},"right_eye_bottom":{"x":998,"y":477},"right_eye_center":{"x":995,"y":470},"right_eye_left_corner":{"x":960,"y":486},"right_eye_lower_left_quarter":{"x":979,"y":482},"right_eye_lower_right_quarter":{"x":1016,"y":469},"right_eye_pupil":{"x":999,"y":467},"right_eye_right_corner":{"x":1032,"y":459},"right_eye_top":{"x":990,"y":459},"right_eye_upper_left_quarter":{"x":973,"y":470},"right_eye_upper_right_quarter":{"x":1011,"y":456},"right_eyebrow_left_corner":{"x":937,"y":445},"right_eyebrow_lower_left_quarter":{"x":964,"y":437},"right_eyebrow_lower_middle":{"x":989,"y":427},"right_eyebrow_lower_right_quarter":{"x":1015,"y":420},"right_eyebrow_right_corner":{"x":1040,"y":413},"right_eyebrow_upper_left_quarter":{"x":956,"y":423},"right_eyebrow_upper_middle":{"x":983,"y":409},"right_eyebrow_upper_right_quarter":{"x":1012,"y":404}},"attributes":{"gender":{"value":"Male"},"age":{"value":27},"beauty":{"male_score":65.213,"female_score":69.013}}}],"image_id":"Q8ki20PR04ig95wz6kv1XQ==","face_num":1}
234
+
235
+ ```
236
+
237
+
238
+
239
+ また、パラメータによってはvalueが取得出来ました。例えば「request_id」や「image_id」は取得出来ます。しかし、valueが波括弧のパラメータを取得しようとすると、undifinedが返ってきます。なので、「beauty」や「age」などのパラメータは取得出来ません。