0

i try to get google suggestion from this url http://suggestqueries.google.com/complete/search?q=bob&client=firefox

when i run the url i get this result : ["bob",["bobby shmurda","bob marley","bobbi kristina","bobbi brown","bobbi kristina brown","bob dylan","bob evans","bobby hurley","bob\u0027s burgers","bob seger"]]

in node.js i used request , heres my code :

var request = require('request');
var url = 'http://suggestqueries.google.com/complete/search?q=bob&client=firefox';
 request(url,function(error, response, result){
    if(!error){
    console.log(result);

    }

 });

until now everythings work fine as you can see my output is an array with two values, in above code when i try to get result[1]instead of show array its just show a ". i dont know why this happen.

2 Answers 2

1

probably because you get a String and not a JSON. try JSON.parse

result = JSON.parse(result)
Sign up to request clarification or add additional context in comments.

Comments

0

try to parse it first

var json_data = JSON.parse(result);  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.