Skip to content

Commit

Permalink
Text vs json.
Browse files Browse the repository at this point in the history
Data is transmitted as text through HTTP, although in this case the
text is the serialization of a JSON object. Upon reception the text
should be parsed to reconstruct a JSON object.
  • Loading branch information
Luis Ibanez committed Dec 19, 2013
1 parent dd02bb5 commit d9ecfe8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nodejs/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ callback = function(response) {

//the whole response has been recieved, so we just print it out here
response.on('end', function () {
console.log(str);
var jsonstr = JSON.parse(str);
console.log(JSON.stringify(jsonstr,null,2));
});
}

Expand Down

0 comments on commit d9ecfe8

Please sign in to comment.