title: Read JSON output from program, then parse JSON in C
body: <p>I've got a program that outputs data in json format. I'm wanting to read from that program and parse the json data, then add my own variables to the json object. I'm lost on how to parse the data once i've done the file open and read. any suggestions on how to parse through it, maybe assign a name to the newly created object?</p>
  
  <p>I'm on linux, writing in C. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;json/json.h&gt;
  
  
  
  
  
  int main(int argc, char ** argv){
  printf("Getting Location Data from pipe: \n");
  
  FILE *in;
  extern FILE *popen();
  char gps_stream[4096];
  
  if(!(in = popen("gpspipe -w", "r"))){
      printf("Cant do it!\n");
  }
  
  while(fgets(gps_stream, sizeof(gps_stream), in)!=NULL){
  
  
  json_object * jobj = json_tokener_parse(gps_stream);
  
  
  }
  pclose(in);
  
  
  }
  </code></pre>