Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:32:14+00:00 2026-06-05T23:32:14+00:00

I have another simple question about Node. I’m trying to make a simple http

  • 0

I have another simple question about Node. I’m trying to make a simple http request to the Open Courseware search API (http://www.ocwsearch.com/api), but I’m running into some problems actually parsing the JSON… which normally hasn’t been a problem.
The request returns a string that has escaped characters and slashes, and so I’ve run a replace and an unescape on the response string, but this ends up returning something like ‘[object Object]’. Right now, all I really want to do is be able to SEE what’s finally being returned, so I can tell whether or not I can finally parse it as valid JSON. Unfortunately, this is not working either. I’ve read a couple of similar threads on stack overflow, but I’m still unable to get it to work.

What I’ve tried:

  • iterating over the object being passed, because I thought it’d be something with key value pairs, and running over it, logging it each time. However, this prints it out as a string:

[

o

b

…
all the way to the end (])

Given x as the returned formatted object in question,

  • using “” + x, toString(), to try to convert it to a string
  • using console.log(“%j”, x) as per How do you log content of a JSON object in Node.js?

None of these seem to work though, they’re all returning me [object Object].

I’ve even tried it in jsfiddle: http://jsfiddle.net/S47QL/2/
I’m replacing console.log with alert, and it seems to be re

My code:

var request = require('request');$
request('http://www.ocwsearch.com/api/v1/search.json?q=' + skill +     '&contact=http%3a%2f%2fwww.ocwsearch.com%2fabout/',$
  function(error, response, body){$
  if(!error && response.statusCode == 200){~$
      console.log(response.toString().replace(/\\\//g, "/"));$
        var x = response.toString().replace(/\\\//g, "/");$
        console.log(x)$
        console.log(x.keys());$
  }$  
});$
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:32:15+00:00Added an answer on June 5, 2026 at 11:32 pm

    Right now, all I really want to do is be able to SEE what’s finally being returned, so I can tell whether or not I can finally parse it as valid JSON.

    So then make the request in a browser window (using Chrome you can see the actual results being returned in the inspector tabs – press F12).

    Example: http://www.ocwsearch.com/api/v1/search.json?q=ios&contact=http%3a%2f%2fwww.ocwsearch.com%2fabout/

    And according to http://jsonlint.com/ this is valid JSON being returned. Are you sure you’re not trying to be too smart for your own good?

    You can’t write the response to string, because it’s an object. You need the data returned, but I think the body field does what you want. Have you tried just printing body?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple question about Python: I have another Python script listening on
I have another question about restoring application state, on the iPhone. Simple data (like
I have another csv file where I am trying to do a simple word
A simple question about Stored Procedures. I have one stored procedure collecting a whole
I have a simple question about url or domain redirect. I was looking through
I have a simple question about sending a file (XML file) from my webapp
I have a simple question about Backbone.js' get and set functions. 1) With the
I have a simple question about passing custom objects via a webservice. I created
I want to put a question about what ideas do you have regarding Open
I have a simple question about git. I would like to know what is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.