Showing
2 changed files
with
15 additions
and
3 deletions
... | @@ -4,4 +4,13 @@ sampleJson = JSON.parse(sampleJson); | ... | @@ -4,4 +4,13 @@ sampleJson = JSON.parse(sampleJson); |
4 | 4 | ||
5 | console.log(sampleJson); | 5 | console.log(sampleJson); |
6 | 6 | ||
7 | -console.log(sampleJson.response[0].player.name); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
7 | +let playerName = sampleJson.response[0].player.name.toString() | ||
8 | + | ||
9 | +console.log(playerName); | ||
10 | +console.log(typeof(playerName)); | ||
11 | +console.log(JSON.stringify(sampleJson.response[0].player.name)); | ||
12 | +console.log(typeof(JSON.stringify(playerName))); | ||
13 | +stringJson = sampleJson.toString(); | ||
14 | + | ||
15 | +console.log(sampleJson.toString()); | ||
16 | +console.log(typeof(stringJson)); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -79,6 +79,9 @@ function Reply(eventObj,replyMsg){ | ... | @@ -79,6 +79,9 @@ function Reply(eventObj,replyMsg){ |
79 | 79 | ||
80 | let replyMsgJSON = JSON.parse(replyMsg); | 80 | let replyMsgJSON = JSON.parse(replyMsg); |
81 | 81 | ||
82 | + let playerMsg = JSON.parse(replyMsgJSON.response[0].player.name); | ||
83 | + let jsonMsg = JSON.parse(replyMsgJSON); | ||
84 | + | ||
82 | request.post( | 85 | request.post( |
83 | { | 86 | { |
84 | url: TARGET_URL, | 87 | url: TARGET_URL, |
... | @@ -90,11 +93,11 @@ function Reply(eventObj,replyMsg){ | ... | @@ -90,11 +93,11 @@ function Reply(eventObj,replyMsg){ |
90 | "messages":[ | 93 | "messages":[ |
91 | { | 94 | { |
92 | "type":"Name", | 95 | "type":"Name", |
93 | - "text":replyMsgJSON.response[0].player.name.toString() | 96 | + "text":playerMsg |
94 | }, | 97 | }, |
95 | { | 98 | { |
96 | "type":"JSON", | 99 | "type":"JSON", |
97 | - "text":replyMsgJSON.toString() | 100 | + "text":jsonMsg |
98 | } | 101 | } |
99 | ] | 102 | ] |
100 | } | 103 | } | ... | ... |
-
Please register or login to post a comment