ofxJSON error?

Hey everyone,

Right now I am trying to pull information from the reddit api. Everything is printing to the console just fine but when I try to build and run I get an error that says "Invalid conversion from ‘const char’ to ‘long unsigned int’ ". I’m not eh best programmer so I’m a little confused as to what this is. This is the code I have running in the draw:

  
vector<string> redditIn = result["data"].getMemberNames();  
	  
	string timestamp = redditIn[0];  
	  
	  
		int n=0;  
		ofxJSONElement reddit = result["children"][timestamp];  
		for(int i=0; i<reddit.size(); i++)  
		{  
			string message = redditIn[i]["title"].asString();         //Error happens here  
			franklinBook.drawString(message, 10, 40*i+40);  
		}  

I know this is a n00b kind of question, hence it being posted in this section. I’d appreciate any help!

Cheers!
Brian

Fixed

I had to replace:

string message = redditIn[i][“title”].asString();

with:

string message = reddit[i][“title”].asString();

For those who looked in thanks!

1 Like